Skip to content

Commit

Permalink
Merge pull request #16 from b1naryth1ef/remove_socket_side_effects
Browse files Browse the repository at this point in the history
Remove global side effects to socket library
  • Loading branch information
jtriley authored Dec 7, 2016
2 parents de7bc85 + 5064530 commit ab5eb34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ def get_nat_type(s, source_ip, source_port, stun_host=None, stun_port=3478):

def get_ip_info(source_ip="0.0.0.0", source_port=54320, stun_host=None,
stun_port=3478):
socket.setdefaulttimeout(2)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(2)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((source_ip, source_port))
nat_type, nat = get_nat_type(s, source_ip, source_port,
Expand Down

0 comments on commit ab5eb34

Please sign in to comment.