util blocking bug test :/

master
Stefan Krulj 14 years ago
parent f2de91ec9a
commit 8f9c510b5c
  1. 7
      sys/util.py

@ -3,7 +3,6 @@ import select
import socket import socket
import threading import threading
import random import random
import config
from Queue import Queue, Empty from Queue import Queue, Empty
MAGIC_PACKET = "" MAGIC_PACKET = ""
@ -76,9 +75,9 @@ def get_local_ip():
while waiting: while waiting:
s2.sendto(bytes(MAGIC_PACKET), ('<broadcast>', 8888)) s2.sendto(bytes(MAGIC_PACKET), ('<broadcast>', 8888))
try: try:
address = queue.get(False) address = queue.get_nowait()
except Empty: except Empty:
address = [config.IP] pass
finally: else:
waiting = False waiting = False
return address[0] return address[0]

Loading…
Cancel
Save