mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Merge pull request #424 from oddstr13/broadcast-not-multicast
Remove multicast socket options from autodiscovery
This commit is contained in:
commit
4b8f510325
1 changed files with 5 additions and 4 deletions
|
@ -213,11 +213,7 @@ class ConnectionManager(object):
|
||||||
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
sock.settimeout(1.0) # This controls the socket.timeout exception
|
sock.settimeout(1.0) # This controls the socket.timeout exception
|
||||||
|
|
||||||
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 20)
|
|
||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||||
sock.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP, 1)
|
|
||||||
sock.setsockopt(socket.IPPROTO_IP, socket.SO_REUSEADDR, 1)
|
|
||||||
|
|
||||||
LOG.debug("MultiGroup : %s", str(MULTI_GROUP))
|
LOG.debug("MultiGroup : %s", str(MULTI_GROUP))
|
||||||
LOG.debug("Sending UDP Data: %s", MESSAGE)
|
LOG.debug("Sending UDP Data: %s", MESSAGE)
|
||||||
|
@ -232,6 +228,8 @@ class ConnectionManager(object):
|
||||||
return servers
|
return servers
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
data = None
|
||||||
|
addr = None
|
||||||
try:
|
try:
|
||||||
data, addr = sock.recvfrom(1024) # buffer size
|
data, addr = sock.recvfrom(1024) # buffer size
|
||||||
servers.append(json.loads(data))
|
servers.append(json.loads(data))
|
||||||
|
@ -240,6 +238,9 @@ class ConnectionManager(object):
|
||||||
LOG.info("Found Servers: %s", servers)
|
LOG.info("Found Servers: %s", servers)
|
||||||
return servers
|
return servers
|
||||||
|
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
LOG.warning("Unable to decode %r from %r.", data, addr)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(traceback.format_exc())
|
LOG.error(traceback.format_exc())
|
||||||
LOG.exception("Error trying to find servers: %s", e)
|
LOG.exception("Error trying to find servers: %s", e)
|
||||||
|
|
Loading…
Reference in a new issue