Software / code / verse
Comparison
client.lua @ 329:2787e038bea2
verse.client: Use a different flag to indicate that our outgoing stream is closed
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 10 Feb 2013 04:52:17 +0100 |
| parent | 323:5bf3b13edb80 |
| child | 336:658c62c9ecc4 |
comparison
equal
deleted
inserted
replaced
| 328:55e3fd7b9731 | 329:2787e038bea2 |
|---|---|
| 30 end | 30 end |
| 31 return true; | 31 return true; |
| 32 end | 32 end |
| 33 | 33 |
| 34 function stream_callbacks.streamclosed(stream) | 34 function stream_callbacks.streamclosed(stream) |
| 35 if not stream.notopen then | 35 stream.notopen = true; |
| 36 if not stream.closed then | |
| 36 stream:send("</stream:stream>"); | 37 stream:send("</stream:stream>"); |
| 37 stream.notopen = true; | 38 stream.closed = true; |
| 38 end | 39 end |
| 39 stream:event("closed"); | 40 stream:event("closed"); |
| 40 return stream:close("stream closed") | 41 return stream:close("stream closed") |
| 41 end | 42 end |
| 42 | 43 |
| 133 self:hook("bind-success", stream_ready, -1); | 134 self:hook("bind-success", stream_ready, -1); |
| 134 | 135 |
| 135 local _base_close = self.close; | 136 local _base_close = self.close; |
| 136 function self:close(reason) | 137 function self:close(reason) |
| 137 self.close = _base_close; | 138 self.close = _base_close; |
| 138 if not self.notopen then | 139 if not self.closed then |
| 139 self:send("</stream:stream>"); | 140 self:send("</stream:stream>"); |
| 140 self.notopen = true; | 141 self.closed = true; |
| 141 else | 142 else |
| 142 return self:close(reason); | 143 return self:close(reason); |
| 143 end | 144 end |
| 144 end | 145 end |
| 145 | 146 |