Software /
code /
prosody
Comparison
net/server_select.lua @ 9916:72501e3c1427
net.server_select: Fix write pause/resume functions
Nothing would happen if the write buffer was empty.
Also simplified the code because it took too long to understand what
`if _sendlistlen ~= tmp then` did.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 24 Mar 2019 20:12:22 +0100 |
parent | 9853:9aea8dbb105d |
child | 9993:02a41315d275 |
comparison
equal
deleted
inserted
replaced
9915:9fe7b18bca15 | 9916:72501e3c1427 |
---|---|
495 end | 495 end |
496 handler.pause_writes = function (self) | 496 handler.pause_writes = function (self) |
497 local tmp = _sendlistlen | 497 local tmp = _sendlistlen |
498 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) | 498 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) |
499 _writetimes[ handler ] = nil | 499 _writetimes[ handler ] = nil |
500 if _sendlistlen ~= tmp then | 500 nosend = true |
501 nosend = true | |
502 end | |
503 end | 501 end |
504 handler.resume_writes = function (self) | 502 handler.resume_writes = function (self) |
505 if nosend then | 503 nosend = false |
506 nosend = false | 504 if bufferlen > 0 then |
507 write( "" ) | 505 _sendlistlen = addsocket(_sendlist, socket, _sendlistlen) |
508 end | 506 end |
509 end | 507 end |
510 | 508 |
511 local _readbuffer = function( ) -- this function reads data | 509 local _readbuffer = function( ) -- this function reads data |
512 local buffer, err, part = receive( socket, pattern ) -- receive buffer with "pattern" | 510 local buffer, err, part = receive( socket, pattern ) -- receive buffer with "pattern" |