mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-14 15:45:15 +01:00
... Correct ip->country again...
This commit is contained in:
parent
6388778cfb
commit
794a8abf03
@ -180,7 +180,7 @@ class Peer:
|
|||||||
|
|
||||||
# Lookup which country this guy is from
|
# Lookup which country this guy is from
|
||||||
try:
|
try:
|
||||||
self.country = srv.ip2c.lookup( self.addr_to_ip_dot_format(addr) )
|
self.country = srv.ip2c.lookup( addr[0] )
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
self.country = None
|
self.country = None
|
||||||
if self.country == None:
|
if self.country == None:
|
||||||
@ -200,11 +200,6 @@ class Peer:
|
|||||||
port = addr[1]
|
port = addr[1]
|
||||||
return "%08x" % (ip), port
|
return "%08x" % (ip), port
|
||||||
|
|
||||||
def addr_to_ip_dot_format(self, addr):
|
|
||||||
ip = struct.unpack("@L", socket.inet_pton(socket.AF_INET, addr[0]))[0]
|
|
||||||
port = addr[1]
|
|
||||||
return "%d.%d.%d.%d" % ((ip & 0xff000000) >> 24, (ip & 0x00ff0000) >> 16, (ip & 0x0000ff00) >> 8, ip & 0xff)
|
|
||||||
|
|
||||||
def handle_packet(self, pkt):
|
def handle_packet(self, pkt):
|
||||||
if pkt.type == CONNECT_TO_BROKER:
|
if pkt.type == CONNECT_TO_BROKER:
|
||||||
self.key = pkt.get_key()
|
self.key = pkt.get_key()
|
||||||
|
Loading…
Reference in New Issue
Block a user