Mercurial > prosody-hg
comparison plugins/mod_s2s/mod_s2s.lua @ 6846:7eb166fa1f26
mod_c2s, mod_s2s: Close incoming connections if there are no features to offer on incomplete streams (fixes #285)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 24 Sep 2015 20:05:23 +0200 |
| parents | 3f05b255937f |
| children | c314e9142e9d 32327c80710b |
comparison
equal
deleted
inserted
replaced
| 6845:bb7854355df1 | 6846:7eb166fa1f26 |
|---|---|
| 349 hosts[to].events.fire_event("s2s-stream-features", { origin = session, features = features }); | 349 hosts[to].events.fire_event("s2s-stream-features", { origin = session, features = features }); |
| 350 else | 350 else |
| 351 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host"); | 351 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host"); |
| 352 end | 352 end |
| 353 | 353 |
| 354 log("debug", "Sending stream features: %s", tostring(features)); | 354 if ( session.type == "s2sin" or session.type == "s2sout" ) or features.tags[1] then |
| 355 session.sends2s(features); | 355 log("debug", "Sending stream features: %s", tostring(features)); |
| 356 session.sends2s(features); | |
| 357 else | |
| 358 (session.log or log)("warn", "No features to offer, giving up"); | |
| 359 session:close({ condition = "undefined-condition", text = "No features to offer" }); | |
| 360 end | |
| 356 end | 361 end |
| 357 elseif session.direction == "outgoing" then | 362 elseif session.direction == "outgoing" then |
| 358 session.notopen = nil; | 363 session.notopen = nil; |
| 359 if not attr.id then | 364 if not attr.id then |
| 360 log("error", "Stream response did not give us a stream id!"); | 365 log("error", "Stream response did not give us a stream id!"); |
