Software /
code /
prosody
Comparison
net/server_event.lua @ 2972:f9901175d535
net.server_event: Call listener.onconnect if it exists, otherwise stick to listener.onincoming
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 11 Apr 2010 01:29:59 +0100 |
parent | 2952:5069534f7f36 |
child | 2988:0c61f73ac0fb |
comparison
equal
deleted
inserted
replaced
2970:9b8e139eff5f | 2972:f9901175d535 |
---|---|
158 function interface_mt:_start_session(onconnect) -- new session, for example after startssl | 158 function interface_mt:_start_session(onconnect) -- new session, for example after startssl |
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:onincoming() | 164 (self.onconnect or self.onincoming)(self) |
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 |