Software /
code /
prosody
Comparison
net/server_select.lua @ 4353:f600591c87fa
net.server_select: Remove socket from sendlist before calling listener callbacks (thanks darkrain)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 20 Aug 2011 16:14:07 -0400 |
parent | 4349:16fd8061964e |
child | 4388:eded80beab58 |
comparison
equal
deleted
inserted
replaced
4352:912a49b1c4e3 | 4353:f600591c87fa |
---|---|
846 _sendlistlen = addsocket(_sendlist, socket, _sendlistlen) | 846 _sendlistlen = addsocket(_sendlist, socket, _sendlistlen) |
847 if listeners.onconnect then | 847 if listeners.onconnect then |
848 -- When socket is writeable, call onconnect | 848 -- When socket is writeable, call onconnect |
849 local _sendbuffer = handler.sendbuffer; | 849 local _sendbuffer = handler.sendbuffer; |
850 handler.sendbuffer = function () | 850 handler.sendbuffer = function () |
851 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ); | |
851 handler.sendbuffer = _sendbuffer; | 852 handler.sendbuffer = _sendbuffer; |
852 listeners.onconnect(handler); | 853 listeners.onconnect(handler); |
853 -- If there was data with the incoming packet, handle it now. | 854 -- If there was data with the incoming packet, handle it now. |
854 if #handler:bufferqueue() > 0 then | 855 if #handler:bufferqueue() > 0 then |
855 return _sendbuffer(); | 856 return _sendbuffer(); |
856 end | 857 end |
857 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) | |
858 end | 858 end |
859 end | 859 end |
860 end | 860 end |
861 return handler, socket | 861 return handler, socket |
862 end | 862 end |