Prevented the 'SendDiscoveryPacket' from crashing.

This commit is contained in:
CodePanter 2016-04-28 16:57:10 +02:00
parent 8d9d03b69a
commit b638c79461

View file

@ -135,6 +135,7 @@ class Canvas(object):
def SendDiscoveryPacket(self): def SendDiscoveryPacket(self):
"""Lets send out our ip/port/resolution to any listening clients""" """Lets send out our ip/port/resolution to any listening clients"""
try:
self.broadcastsocket.sendto( self.broadcastsocket.sendto(
'%s:%f %s:%d %d*%d' % (PROTOCOL_PREAMBLE, PROTOCOL_VERSION, '%s:%f %s:%d %d*%d' % (PROTOCOL_PREAMBLE, PROTOCOL_VERSION,
UDP_IP, UDP_PORT, UDP_IP, UDP_PORT,
@ -142,6 +143,9 @@ class Canvas(object):
('<broadcast>', DISCOVER_PORT)) ('<broadcast>', DISCOVER_PORT))
if self.debug: if self.debug:
print 'sending discovery packet' print 'sending discovery packet'
except Exception as error:
if self.debug:
print error
def __del__(self): def __del__(self):
"""Clean up any sockets we created""" """Clean up any sockets we created"""