diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-28 14:25:11 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-28 14:25:11 +0100 |
commit | afd25ad763e144ae93209b2aab9540b9ec45abcb (patch) | |
tree | 4f919bf57123f08e84069af90b79aba798889e2a | |
parent | b9ac1b8b07a8f0ac3c16595a544132ea6f43e998 (diff) | |
download | prosody-afd25ad763e144ae93209b2aab9540b9ec45abcb.tar.gz prosody-afd25ad763e144ae93209b2aab9540b9ec45abcb.zip |
net.server_event: Remove comments about not closing event handlers from within callbacks, fixed in luaevent
-rw-r--r-- | net/server_event.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/server_event.lua b/net/server_event.lua index f2626f5f..5316866e 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -6,7 +6,6 @@ notes: -- when using luaevent, never register 2 or more EV_READ at one socket, same for EV_WRITE -- you cant even register a new EV_READ/EV_WRITE callback inside another one - -- never call eventcallback:close( ) from inside eventcallback -- to do some of the above, use timeout events or something what will called from outside -- dont let garbagecollect eventcallbacks, as long they are running -- when using luasec, there are 4 cases of timeout errors: wantread or wantwrite during reading or writing @@ -248,7 +247,7 @@ do debug( "closing client with id:", self.id, self.fatalerror ) self:_lock( true, true, true ) -- first of all, lock the interface to avoid further actions local _ - _ = self.eventread and self.eventread:close( ) -- close events; this must be called outside of the event callbacks! + _ = self.eventread and self.eventread:close( ) if self.type == "client" then _ = self.eventwrite and self.eventwrite:close( ) _ = self.eventhandshake and self.eventhandshake:close( ) @@ -258,7 +257,7 @@ do _ = self.eventwritetimeout and self.eventwritetimeout:close( ) _ = self.eventreadtimeout and self.eventreadtimeout:close( ) _ = self.ondisconnect and self:ondisconnect( self.fatalerror ~= "client to close" and self.fatalerror) -- call ondisconnect listener (wont be the case if handshake failed on connect) - _ = self.conn and self.conn:close( ) -- close connection, must also be called outside of any socket registered events! + _ = self.conn and self.conn:close( ) -- close connection _ = self._server and self._server:counter(-1); self.eventread, self.eventwrite = nil, nil self.eventstarthandshake, self.eventhandshake, self.eventclose = nil, nil, nil @@ -342,7 +341,7 @@ do debug( "try to close server with id:", tostring(self.id)) self.fatalerror = "server to close" self:_lock( true ) - self:_close( 0 ) -- add new event to remove the server interface + self:_close( 0 ) return true end end |