don't overwrite stanza ID in zeroconf so that we reply with correct ID to requests. Thanks Mattj

This commit is contained in:
Yann Leboulanger 2009-04-25 16:29:49 +00:00
parent fdcf75ae59
commit 665016ccc0
1 changed files with 8 additions and 5 deletions

View File

@ -689,8 +689,9 @@ class ClientZeroconf:
# look for hashed connections
if to in self.recipient_to_hash:
conn = self.connections[self.recipient_to_hash[to]]
id_ = conn.Dispatcher.getAnID()
stanza.setID(id_)
if not stanza.getID():
id_ = conn.Dispatcher.getAnID()
stanza.setID(id_)
if conn.add_stanza(stanza, is_message):
if on_ok:
on_ok(id_)
@ -699,14 +700,16 @@ class ClientZeroconf:
hash_ = self.ip_to_hash[item['address']]
if self.hash_to_port[hash_] == item['port']:
conn = self.connections[hash_]
id_ = conn.Dispatcher.getAnID()
stanza.setID(id_)
if not stanza.getID():
id_ = conn.Dispatcher.getAnID()
stanza.setID(id_)
if conn.add_stanza(stanza, is_message):
if on_ok:
on_ok(id_)
# otherwise open new connection
stanza.setID('zero')
if not stanza.getID():
stanza.setID('zero')
P2PClient(None, item['address'], item['port'], self,
[(stanza, is_message)], to, on_ok=on_ok, on_not_ok=on_not_ok)