Software / code / verse
Comparison
init.lua @ 465:6707e3a47f71
Add 'shutdown' event for a self-initiated disconnect
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 17 Mar 2023 09:23:15 +0000 |
| parent | 464:dc05a8d6dbfb |
| child | 490:6b2f31da9610 |
comparison
equal
deleted
inserted
replaced
| 464:dc05a8d6dbfb | 465:6707e3a47f71 |
|---|---|
| 150 if not self.conn then | 150 if not self.conn then |
| 151 verse.log("error", "Attempt to close disconnected connection - possibly a bug"); | 151 verse.log("error", "Attempt to close disconnected connection - possibly a bug"); |
| 152 return; | 152 return; |
| 153 end | 153 end |
| 154 local on_disconnect = self.conn.disconnect(); | 154 local on_disconnect = self.conn.disconnect(); |
| 155 self:event("shutdown"); | |
| 155 self.conn:close(); | 156 self.conn:close(); |
| 156 on_disconnect(self.conn, reason); | 157 on_disconnect(self.conn, reason); |
| 157 end | 158 end |
| 158 | 159 |
| 159 -- Logging functions | 160 -- Logging functions |