nixio util:

Don't shutdown TLS connection on close()
This could lead to problems when calling close on a forked socket
sink() also shutdown connection if close is requested and possible
This commit is contained in:
Steven Barth 2009-03-06 16:34:26 +00:00
parent 2d49488b38
commit 09a18c2c31

View file

@ -151,6 +151,9 @@ end
function meta.sink(self, close) function meta.sink(self, close)
return function(chunk, src_err) return function(chunk, src_err)
if not chunk and not src_err and close then if not chunk and not src_err and close then
if self.shutdown then
self:shutdown()
end
self:close() self:close()
elseif chunk and #chunk > 0 then elseif chunk and #chunk > 0 then
return self:writeall(chunk) return self:writeall(chunk)
@ -160,7 +163,6 @@ function meta.sink(self, close)
end end
function tls_socket.close(self) function tls_socket.close(self)
self:shutdown()
return self.socket:close() return self.socket:close()
end end