aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-28 16:53:10 +0100
committerKim Alvefur <zash@zash.se>2018-10-28 16:53:10 +0100
commitb593a8c54f2c37aefae0503b130242589e42dc79 (patch)
treed3fc5a3be3b54c832ecc62345d7d633f7806fe3c /net
parentef4bb01f0da61e8512c0c6f9dffb2c1822f42c05 (diff)
downloadprosody-b593a8c54f2c37aefae0503b130242589e42dc79.tar.gz
prosody-b593a8c54f2c37aefae0503b130242589e42dc79.zip
net.server_select: Move code from :lock_read into :pause and :resume
Diffstat (limited to 'net')
-rw-r--r--net/server_select.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 1c016633..51a74c94 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -459,26 +459,28 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
handler.lock_read = function (self, switch)
out_error( "server.lua, lock_read() is deprecated, use pause() and resume()" )
if switch == true then
- local tmp = _readlistlen
- _readlistlen = removesocket( _readlist, socket, _readlistlen )
- _readtimes[ handler ] = nil
- if _readlistlen ~= tmp then
- noread = true
- end
+ return self:pause()
elseif switch == false then
- if noread then
- noread = false
- _readlistlen = addsocket(_readlist, socket, _readlistlen)
- _readtimes[ handler ] = _currenttime
- end
+ return self:resume()
end
return noread
end
handler.pause = function (self)
- return self:lock_read(true);
+ local tmp = _readlistlen
+ _readlistlen = removesocket( _readlist, socket, _readlistlen )
+ _readtimes[ handler ] = nil
+ if _readlistlen ~= tmp then
+ noread = true
+ end
+ return noread;
end
handler.resume = function (self)
- return self:lock_read(false);
+ if noread then
+ noread = false
+ _readlistlen = addsocket(_readlist, socket, _readlistlen)
+ _readtimes[ handler ] = _currenttime
+ end
+ return noread;
end
handler.lock = function( self, switch )
handler.lock_read (switch)