diff -r 55e3fd7b9731 -r 2787e038bea2 client.lua --- a/client.lua Sun Feb 10 04:29:20 2013 +0100 +++ b/client.lua Sun Feb 10 04:52:17 2013 +0100 @@ -32,9 +32,10 @@ end function stream_callbacks.streamclosed(stream) - if not stream.notopen then + stream.notopen = true; + if not stream.closed then stream:send(""); - stream.notopen = true; + stream.closed = true; end stream:event("closed"); return stream:close("stream closed") @@ -135,9 +136,9 @@ local _base_close = self.close; function self:close(reason) self.close = _base_close; - if not self.notopen then + if not self.closed then self:send(""); - self.notopen = true; + self.closed = true; else return self:close(reason); end