aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-10-22 06:33:30 +0100
committerMatthew Wild <mwild1@gmail.com>2010-10-22 06:33:30 +0100
commit2d18b1e9a70fc44919fad7fb2e971e6ce24ece5a (patch)
treef2d0d34e21c3f6202cd0a172fbd8e5607ab1dd39 /net/server_select.lua
parent8e1bc4ff71ab6a0ef04da5ec8eade06092fe93a0 (diff)
downloadprosody-2d18b1e9a70fc44919fad7fb2e971e6ce24ece5a.tar.gz
prosody-2d18b1e9a70fc44919fad7fb2e971e6ce24ece5a.zip
net.server_select: Restore real sendbuffer() before calling onconnect handler, in case onconnect sends data and the socket is still writeable (causing stack overflow into sendbuffer()/onconnect())
Diffstat (limited to 'net/server_select.lua')
-rw-r--r--net/server_select.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index c6e90d55..186ce227 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -853,8 +853,8 @@ local wrapclient = function( socket, ip, serverport, listeners, pattern, sslctx
-- When socket is writeable, call onconnect
local _sendbuffer = handler.sendbuffer;
handler.sendbuffer = function ()
- listeners.onconnect(handler);
handler.sendbuffer = _sendbuffer;
+ listeners.onconnect(handler);
-- If there was data with the incoming packet, handle it now.
if #handler:bufferqueue() > 0 then
return _sendbuffer();