Software /
code /
prosody
Comparison
net/server_select.lua @ 5949:a9abbdeddbf3
net.server_select: Don't remove the socket from sendlist when we might have data in the buffer (we'll now let sendbuffer() take care of that) (thanks daurnimator)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 16 Dec 2013 23:31:43 +0000 |
parent | 5663:4e51ceee469c |
child | 5950:bd1d1c29a7e7 |
child | 6047:4db0403bfc0d |
comparison
equal
deleted
inserted
replaced
5948:1341384628ec | 5949:a9abbdeddbf3 |
---|---|
914 _sendlistlen = addsocket(_sendlist, socket, _sendlistlen) | 914 _sendlistlen = addsocket(_sendlist, socket, _sendlistlen) |
915 if listeners.onconnect then | 915 if listeners.onconnect then |
916 -- When socket is writeable, call onconnect | 916 -- When socket is writeable, call onconnect |
917 local _sendbuffer = handler.sendbuffer; | 917 local _sendbuffer = handler.sendbuffer; |
918 handler.sendbuffer = function () | 918 handler.sendbuffer = function () |
919 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ); | |
920 handler.sendbuffer = _sendbuffer; | 919 handler.sendbuffer = _sendbuffer; |
921 listeners.onconnect(handler); | 920 listeners.onconnect(handler); |
922 -- If there was data with the incoming packet, handle it now. | 921 return _sendbuffer(); -- Send any queued outgoing data |
923 if #handler:bufferqueue() > 0 then | |
924 return _sendbuffer(); | |
925 end | |
926 end | 922 end |
927 end | 923 end |
928 end | 924 end |
929 return handler, socket | 925 return handler, socket |
930 end | 926 end |