Mercurial > prosody-hg
comparison plugins/mod_c2s.lua @ 11742:9c450185bac1
mod_c2s,mod_s2s: Fire event just before writes
Could allow e.g. a XEP-0198 implementation to efficiently send ack
requests at optimal times without using timers or nextTick.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 16 Aug 2021 12:45:14 +0200 |
| parents | a62146353528 |
| children | 9f723b54e111 |
comparison
equal
deleted
inserted
replaced
| 11741:dcf38ac6a38c | 11742:9c450185bac1 |
|---|---|
| 391 if session then | 391 if session then |
| 392 return (hosts[session.host] or prosody).events.fire_event("c2s-ondrain", { session = session }); | 392 return (hosts[session.host] or prosody).events.fire_event("c2s-ondrain", { session = session }); |
| 393 end | 393 end |
| 394 end | 394 end |
| 395 | 395 |
| 396 function listener.onpredrain(conn) | |
| 397 local session = sessions[conn]; | |
| 398 if session then | |
| 399 return (hosts[session.host] or prosody).events.fire_event("c2s-pre-ondrain", { session = session }); | |
| 400 end | |
| 401 end | |
| 402 | |
| 396 local function keepalive(event) | 403 local function keepalive(event) |
| 397 local session = event.session; | 404 local session = event.session; |
| 398 if not session.notopen then | 405 if not session.notopen then |
| 399 return event.session.send(' '); | 406 return event.session.send(' '); |
| 400 end | 407 end |
