diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-11-18 22:16:06 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-11-18 22:16:06 +0000 |
commit | 49e7fdc3641d412592fe905ab7a6ed15cfbf72c1 (patch) | |
tree | d445fe37a39e03e5c2b507aaa9ece3788027b3e5 | |
parent | a6970f5b2b46915fa39ede1d11eb4758bc18cb9d (diff) | |
download | prosody-49e7fdc3641d412592fe905ab7a6ed15cfbf72c1.tar.gz prosody-49e7fdc3641d412592fe905ab7a6ed15cfbf72c1.zip |
Fix to prevent send retry when connection is already closed
-rw-r--r-- | net/server.lua | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/server.lua b/net/server.lua index dece7273..3ff777d5 100644 --- a/net/server.lua +++ b/net/server.lua @@ -190,7 +190,7 @@ wrapsslclient = function( listener, socket, ip, serverport, clientport, mode, ss local writequeue = { } -- buffer for messages to send
- local eol -- end of buffer
+ local eol, fatal_send_error -- end of buffer
local sstat, rstat = 0, 0
@@ -225,7 +225,7 @@ wrapsslclient = function( listener, socket, ip, serverport, clientport, mode, ss --return shutdown( socket, pattern )
end
handler.close = function( closed )
- if eol then handler._dispatchdata(); end
+ if eol and not fatal_send_error then handler._dispatchdata(); end
close( socket )
writelen = ( eol and removesocket( writelist, socket, writelen ) ) or writelen
readlen = removesocket( readlist, socket, readlen )
@@ -296,6 +296,7 @@ wrapsslclient = function( listener, socket, ip, serverport, clientport, mode, ss eol = 1
return true
else -- connection was closed during sending or fatal error
+ fatal_send_error = true;
out_put( "server.lua: client ", ip, ":", clientport, " error: ", err )
handler.close( )
disconnect( handler, err )
@@ -371,7 +372,7 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss local writequeue = { } -- buffer for messages to send
- local eol -- end of buffer
+ local eol, fatal_send_error -- end of buffer
local sstat, rstat = 0, 0
@@ -406,7 +407,7 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss --return shutdown( socket, pattern )
end
handler.close = function( closed )
- if eol then handler._dispatchdata(); end
+ if eol and not fatal_send_error then handler._dispatchdata(); end
close( socket )
writelen = ( eol and removesocket( writelist, socket, writelen ) ) or writelen
readlen = removesocket( readlist, socket, readlen )
@@ -484,6 +485,7 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss eol = 1
return true
else -- connection was closed during sending or fatal error
+ fatal_send_error = true; -- :(
out_put( "server.lua: client ", ip, ":", clientport, " error: ", err )
handler.close( )
disconnect( handler, err )
@@ -582,7 +584,7 @@ wraptcpclient = function( listener, socket, ip, serverport, clientport, mode ) local writequeue = { } -- list for messages to send
- local eol
+ local eol, fatal_send_error
local rstat, sstat = 0, 0
@@ -617,7 +619,7 @@ wraptcpclient = function( listener, socket, ip, serverport, clientport, mode ) return shutdown( socket, pattern )
end
handler.close = function( closed )
- if eol then handler._dispatchdata(); end
+ if eol and not fatal_send_error then handler._dispatchdata(); end
_ = not closed and shutdown( socket )
_ = not closed and close( socket )
writelen = ( eol and removesocket( writelist, socket, writelen ) ) or writelen
@@ -690,6 +692,7 @@ wraptcpclient = function( listener, socket, ip, serverport, clientport, mode ) eol = 1
return true
else -- connection was closed during sending or fatal error
+ fatal_send_error = true; -- :'-(
out_put( "server.lua: client ", ip, ":", clientport, " error: ", err )
handler.close( )
disconnect( handler, err )
|