Software / code / prosody
Comparison
net/server_epoll.lua @ 9385:58fe099043ed
net.server: Call a 'onattach' callback when replacing listeners
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 26 Sep 2018 14:25:59 +0200 |
| parent | 9384:5c8006ce8cb8 |
| child | 9387:33e52f727f0f |
comparison
equal
deleted
inserted
replaced
| 9384:5c8006ce8cb8 | 9385:58fe099043ed |
|---|---|
| 137 | 137 |
| 138 -- Replace the listener and tell the old one | 138 -- Replace the listener and tell the old one |
| 139 function interface:setlistener(listeners) | 139 function interface:setlistener(listeners) |
| 140 self:on("detach"); | 140 self:on("detach"); |
| 141 self.listeners = listeners; | 141 self.listeners = listeners; |
| 142 self:on("attach"); | |
| 142 end | 143 end |
| 143 | 144 |
| 144 -- Call a listener callback | 145 -- Call a listener callback |
| 145 function interface:on(what, ...) | 146 function interface:on(what, ...) |
| 146 if not self.listeners then | 147 if not self.listeners then |