Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 6adc7ae

Browse files
committed
Fix restricted/symmetric nat pairing
1 parent 6bef5dc commit 6adc7ae

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

net/rpcudp.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ def func(node, *args):
202202

203203
address = (node.ip, node.port)
204204
relay_addr = None
205-
if node.nat_type == SYMMETRIC:
205+
if node.nat_type == SYMMETRIC or \
206+
(node.nat_type == RESTRICTED and self.sourceNode.nat_type == SYMMETRIC):
206207
relay_addr = node.relay_node
207208

208209
d = defer.Deferred()
@@ -213,7 +214,9 @@ def func(node, *args):
213214

214215
self.multiplexer.send_message(data, address, relay_addr)
215216

216-
if self.multiplexer[address].state != State.CONNECTED and node.nat_type == RESTRICTED:
217+
if self.multiplexer[address].state != State.CONNECTED and \
218+
node.nat_type == RESTRICTED and \
219+
self.sourceNode.nat_type != SYMMETRIC:
217220
self.hole_punch(Node(digest("null"), node.relay_node[0], node.relay_node[1], nat_type=FULL_CONE),
218221
address[0], address[1], "True")
219222
self.log.debug("sending hole punch message to %s" % address[0] + ":" + str(address[1]))

0 commit comments

Comments
 (0)