Software /
code /
prosody
Comparison
core/s2smanager.lua @ 3308:f5243ca9662f
s2smanager: Register outgoing connection with the connection listener only after initializing filters (thanks darkrain, dersd)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 02 Jul 2010 17:43:01 +0100 |
parent | 3265:9374f84c6677 |
child | 3312:12fc7e005e8b |
comparison
equal
deleted
inserted
replaced
3307:3d7acda82eed | 3308:f5243ca9662f |
---|---|
340 | 340 |
341 local cl = connlisteners_get("xmppserver"); | 341 local cl = connlisteners_get("xmppserver"); |
342 conn = wrapclient(conn, connect_host, connect_port, cl, cl.default_mode or 1 ); | 342 conn = wrapclient(conn, connect_host, connect_port, cl, cl.default_mode or 1 ); |
343 host_session.conn = conn; | 343 host_session.conn = conn; |
344 | 344 |
345 -- Register this outgoing connection so that xmppserver_listener knows about it | |
346 -- otherwise it will assume it is a new incoming connection | |
347 cl.register_outgoing(conn, host_session); | |
348 | |
349 local filter = initialize_filters(host_session); | 345 local filter = initialize_filters(host_session); |
350 local w, log = conn.write, host_session.log; | 346 local w, log = conn.write, host_session.log; |
351 host_session.sends2s = function (t) | 347 host_session.sends2s = function (t) |
352 log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?")); | 348 log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?")); |
353 if t.name then | 349 if t.name then |
358 if t then | 354 if t then |
359 return w(conn, tostring(t)); | 355 return w(conn, tostring(t)); |
360 end | 356 end |
361 end | 357 end |
362 end | 358 end |
359 | |
360 -- Register this outgoing connection so that xmppserver_listener knows about it | |
361 -- otherwise it will assume it is a new incoming connection | |
362 cl.register_outgoing(conn, host_session); | |
363 | 363 |
364 host_session:open_stream(from_host, to_host); | 364 host_session:open_stream(from_host, to_host); |
365 | 365 |
366 log("debug", "Connection attempt in progress..."); | 366 log("debug", "Connection attempt in progress..."); |
367 add_task(connect_timeout, function () | 367 add_task(connect_timeout, function () |