Software /
code /
prosody
Comparison
net/server_event.lua @ 7384:65abd9d7bf88
net.server_event: Re-add write event if writebuffer is non-empty after write (eg due to writes from ondrain callback) (fixes #661)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 19 Apr 2016 17:24:00 +0200 |
parent | 7223:f911f929ca6c |
child | 7385:17929cdacec2 |
child | 7392:c774622ad9db |
comparison
equal
deleted
inserted
replaced
7383:69827ee1f951 | 7384:65abd9d7bf88 |
---|---|
546 debug "starting ssl handshake after writing" | 546 debug "starting ssl handshake after writing" |
547 interface.eventstarthandshake = addevent( base, nil, EV_TIMEOUT, interface.startsslcallback, 0 ) | 547 interface.eventstarthandshake = addevent( base, nil, EV_TIMEOUT, interface.startsslcallback, 0 ) |
548 elseif interface.eventreadtimeout then | 548 elseif interface.eventreadtimeout then |
549 return EV_WRITE, EV_TIMEOUT | 549 return EV_WRITE, EV_TIMEOUT |
550 end | 550 end |
551 if interface.writebuffer ~= 0 then | |
552 -- data possibly written from ondrain | |
553 return EV_WRITE, cfg.WRITE_TIMEOUT | |
554 end | |
551 interface.eventwrite = nil | 555 interface.eventwrite = nil |
552 return -1 | 556 return -1 |
553 elseif byte and (err == "timeout" or err == "wantwrite") then -- want write again | 557 elseif byte and (err == "timeout" or err == "wantwrite") then -- want write again |
554 --vdebug( "writebuffer is not empty:", err ) | 558 --vdebug( "writebuffer is not empty:", err ) |
555 interface.writebuffer[1] = string_sub( interface.writebuffer[1], byte + 1, interface.writebufferlen ) -- new buffer | 559 interface.writebuffer[1] = string_sub( interface.writebuffer[1], byte + 1, interface.writebufferlen ) -- new buffer |