X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=musicpd.py;h=6146a7a3be1bcc8dc959813d541610105519fbf7;hb=56b72eaeb273c06cb17c54e980954e6c82be2346;hp=aae85a5f5348e897760cfe4248668a8b58047c68;hpb=a1d6fc6df18bca9a06232a77deecf241f48de92c;p=python-musicpd.git diff --git a/musicpd.py b/musicpd.py index aae85a5..6146a7a 100644 --- a/musicpd.py +++ b/musicpd.py @@ -2,6 +2,7 @@ # Copyright (C) 2008-2010 J. Alexander Treuman # Copyright (C) 2012-2019 Kaliko Jack # Copyright (C) 2019 Naglis Jonaitis +# Copyright (C) 2019 Bart Van Loon # # python-musicpd is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -28,7 +29,8 @@ HELLO_PREFIX = "OK MPD " ERROR_PREFIX = "ACK " SUCCESS = "OK" NEXT = "list_OK" -VERSION = '0.4.4' +VERSION = '0.4.5' +CONNECTION_TIMEOUT = 5 # seconds before a tcp connection attempt times out def iterator_wrapper(func): @@ -556,7 +558,9 @@ class MPDClient: sock = None try: sock = socket.socket(af, socktype, proto) + sock.settimeout(CONNECTION_TIMEOUT) sock.connect(sa) + sock.settimeout(None) return sock except socket.error as socket_err: err = socket_err