fix the to attribute of stream initiation in zeroconf network. see #3057

This commit is contained in:
Yann Leboulanger 2007-04-25 09:01:05 +00:00
parent 776c4614d5
commit 2dd261e97d
1 changed files with 5 additions and 2 deletions

View File

@ -179,10 +179,11 @@ class P2PClient(IdleObject):
self.Dispatcher._metastream = Node('stream:stream')
self.Dispatcher._metastream.setNamespace(self.Namespace)
# XXX TLS support
#~ self._metastream.setAttr('version', '1.0')
self.Dispatcher._metastream.setAttr('version', '1.0')
self.Dispatcher._metastream.setAttr('xmlns:stream', NS_STREAMS)
self.Dispatcher._metastream.setAttr('from', self.conn_holder.zeroconf.name)
self.Dispatcher._metastream.setAttr('to', self.to)
if self.to:
self.Dispatcher._metastream.setAttr('to', self.to)
self.Dispatcher.send("<?xml version='1.0'?>%s>" % str(self.Dispatcher._metastream)[:-2])
def _check_stream_start(self, ns, tag, attrs):
@ -193,6 +194,8 @@ class P2PClient(IdleObject):
self.Connection.disconnect()
return
if self.sock_type == TYPE_SERVER:
if attrs.has_key('from'):
self.to = attrs['from']
self.send_stream_header()
while self.stanzaqueue:
stanza, is_message = self.stanzaqueue.pop(0)