Mercurial > prosody-hg
comparison net/server_event.lua @ 2236:cf7192f48c56
net.server_event: Count the number of client connections *upwards* :)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 26 Nov 2009 22:19:49 +0000 |
| parents | 91b9587a0210 |
| children | 63fc3cb50dc8 |
comparison
equal
deleted
inserted
replaced
| 2235:91b9587a0210 | 2236:cf7192f48c56 |
|---|---|
| 261 _ = self.eventsession and self.eventsession:close( ) | 261 _ = self.eventsession and self.eventsession:close( ) |
| 262 _ = self.eventwritetimeout and self.eventwritetimeout:close( ) | 262 _ = self.eventwritetimeout and self.eventwritetimeout:close( ) |
| 263 _ = self.eventreadtimeout and self.eventreadtimeout:close( ) | 263 _ = self.eventreadtimeout and self.eventreadtimeout:close( ) |
| 264 _ = self.ondisconnect and self:ondisconnect( self.fatalerror ) -- call ondisconnect listener (wont be the case if handshake failed on connect) | 264 _ = self.ondisconnect and self:ondisconnect( self.fatalerror ) -- call ondisconnect listener (wont be the case if handshake failed on connect) |
| 265 _ = self.conn and self.conn:close( ) -- close connection, must also be called outside of any socket registered events! | 265 _ = self.conn and self.conn:close( ) -- close connection, must also be called outside of any socket registered events! |
| 266 self._server:counter(-1); | 266 _ = self._server and self._server:counter(-1); |
| 267 self.eventread, self.eventwrite = nil, nil | 267 self.eventread, self.eventwrite = nil, nil |
| 268 self.eventstarthandshake, self.eventhandshake, self.eventclose = nil, nil, nil | 268 self.eventstarthandshake, self.eventhandshake, self.eventclose = nil, nil, nil |
| 269 self.readcallback, self.writecallback = nil, nil | 269 self.readcallback, self.writecallback = nil, nil |
| 270 else | 270 else |
| 271 self.conn:close( ) | 271 self.conn:close( ) |
| 281 return nointerface, noreading, nowriting | 281 return nointerface, noreading, nowriting |
| 282 end | 282 end |
| 283 | 283 |
| 284 function interface_mt:counter(c) | 284 function interface_mt:counter(c) |
| 285 if c then | 285 if c then |
| 286 self._connections = self._connections - c | 286 self._connections = self._connections + c |
| 287 end | 287 end |
| 288 return self._connections | 288 return self._connections |
| 289 end | 289 end |
| 290 | 290 |
| 291 -- Public methods | 291 -- Public methods |
