Software /
code /
prosody
Comparison
net/server_event.lua @ 2988:0c61f73ac0fb
net.server_event: Be sure to fire onincoming for backwards-compatibility with pre-onconnect listeners (thanks darkrain/mod_console)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 May 2010 11:24:45 +0100 |
parent | 2972:f9901175d535 |
child | 3000:43a4cb707fe4 |
comparison
equal
deleted
inserted
replaced
2984:3094166cfdd5 | 2988:0c61f73ac0fb |
---|---|
159 if self.type == "client" then | 159 if self.type == "client" then |
160 local callback = function( ) | 160 local callback = function( ) |
161 self:_lock( false, false, false ) | 161 self:_lock( false, false, false ) |
162 --vdebug( "start listening on client socket with id:", self.id ) | 162 --vdebug( "start listening on client socket with id:", self.id ) |
163 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback | 163 self.eventread = addevent( base, self.conn, EV_READ, self.readcallback, cfg.READ_TIMEOUT ); -- register callback |
164 (self.onconnect or self.onincoming)(self) | 164 self:onconnect() |
165 self.eventsession = nil | 165 self.eventsession = nil |
166 return -1 | 166 return -1 |
167 end | 167 end |
168 self.eventsession = addevent( base, nil, EV_TIMEOUT, callback, 0 ) | 168 self.eventsession = addevent( base, nil, EV_TIMEOUT, callback, 0 ) |
169 else | 169 else |
435 = listener.onconnect, listener.ondisconnect, listener.onincoming, listener.ontimeout, listener.onstatus; | 435 = listener.onconnect, listener.ondisconnect, listener.onincoming, listener.ontimeout, listener.onstatus; |
436 end | 436 end |
437 | 437 |
438 -- Stub handlers | 438 -- Stub handlers |
439 function interface_mt:onconnect() | 439 function interface_mt:onconnect() |
440 return self:onincoming(nil); | |
440 end | 441 end |
441 function interface_mt:onincoming() | 442 function interface_mt:onincoming() |
442 end | 443 end |
443 function interface_mt:ondisconnect() | 444 function interface_mt:ondisconnect() |
444 end | 445 end |