Software /
code /
prosody
Comparison
net/server_event.lua @ 2234:065faeb590b9
net.server_event: Fix to make ontimeout() listener callback work
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 26 Nov 2009 22:15:40 +0000 |
parent | 2126:12669db7ed4a |
child | 2235:91b9587a0210 |
comparison
equal
deleted
inserted
replaced
2233:459c1d1cae95 | 2234:065faeb590b9 |
---|---|
136 | 136 |
137 function interface_mt:_start_connection(plainssl) -- should be called from addclient | 137 function interface_mt:_start_connection(plainssl) -- should be called from addclient |
138 local callback = function( event ) | 138 local callback = function( event ) |
139 if EV_TIMEOUT == event then -- timout during connection | 139 if EV_TIMEOUT == event then -- timout during connection |
140 self.fatalerror = "connection timeout" | 140 self.fatalerror = "connection timeout" |
141 self.listener.ontimeout( self ) -- call timeout listener | 141 self:ontimeout() -- call timeout listener |
142 self:_close() | 142 self:_close() |
143 debug( "new connection failed. id:", self.id, "error:", self.fatalerror ) | 143 debug( "new connection failed. id:", self.id, "error:", self.fatalerror ) |
144 else | 144 else |
145 if plainssl then -- start ssl session | 145 if plainssl then -- start ssl session |
146 self:_start_ssl( self.listener.onconnect ) | 146 self:_start_ssl( self.listener.onconnect ) |
430 send = client.send; -- caching table lookups | 430 send = client.send; -- caching table lookups |
431 receive = client.receive; | 431 receive = client.receive; |
432 onconnect = listener.onconnect; -- will be called when client disconnects | 432 onconnect = listener.onconnect; -- will be called when client disconnects |
433 ondisconnect = listener.ondisconnect; -- will be called when client disconnects | 433 ondisconnect = listener.ondisconnect; -- will be called when client disconnects |
434 onincoming = listener.onincoming; -- will be called when client sends data | 434 onincoming = listener.onincoming; -- will be called when client sends data |
435 ontimeout = listener.ontimeout; -- called when fatal socket timeout occurs | |
435 eventread = false, eventwrite = false, eventclose = false, | 436 eventread = false, eventwrite = false, eventclose = false, |
436 eventhandshake = false, eventstarthandshake = false; -- event handler | 437 eventhandshake = false, eventstarthandshake = false; -- event handler |
437 eventconnect = false, eventsession = false; -- more event handler... | 438 eventconnect = false, eventsession = false; -- more event handler... |
438 eventwritetimeout = false; -- even more event handler... | 439 eventwritetimeout = false; -- even more event handler... |
439 eventreadtimeout = false; | 440 eventreadtimeout = false; |