Mercurial > prosody-hg
comparison net/server_event.lua @ 2641:b083a667e3be
net.server_event: Fire onincoming() callback for new connections as opposed to the new onconnect() - let's change this for a future version though
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 14 Feb 2010 20:47:09 +0000 |
| parents | a7f683622b35 |
| children | 9fab59009397 |
comparison
equal
deleted
inserted
replaced
| 2640:2dace3e87dd1 | 2641:b083a667e3be |
|---|---|
| 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() | 164 self:onincoming() |
| 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 |
| 675 clientinterface:starttls(sslctx) | 675 clientinterface:starttls(sslctx) |
| 676 else | 676 else |
| 677 clientinterface:_start_session( clientinterface.onconnect ) | 677 clientinterface:_start_session( clientinterface.onconnect ) |
| 678 end | 678 end |
| 679 debug( "accepted incoming client connection from:", ip, port ) | 679 debug( "accepted incoming client connection from:", ip, port ) |
| 680 | |
| 680 client, err = server:accept() -- try to accept again | 681 client, err = server:accept() -- try to accept again |
| 681 end | 682 end |
| 682 return EV_READ | 683 return EV_READ |
| 683 end | 684 end |
| 684 | 685 |
