aboutsummaryrefslogtreecommitdiffstats
path: root/net/server.lua
diff options
context:
space:
mode:
Diffstat (limited to 'net/server.lua')
-rw-r--r--net/server.lua15
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 )