]> kaliko git repositories - python-musicpd.git/blobdiff - musicpd.py
Add current year in documentation copyright
[python-musicpd.git] / musicpd.py
index aae85a5f5348e897760cfe4248668a8b58047c68..6146a7a3be1bcc8dc959813d541610105519fbf7 100644 (file)
@@ -2,6 +2,7 @@
 # Copyright (C) 2008-2010  J. Alexander Treuman <jat@spatialrift.net>
 # Copyright (C) 2012-2019  Kaliko Jack <kaliko@azylum.org>
 # Copyright (C) 2019       Naglis Jonaitis <naglis@mailbox.org>
+# Copyright (C) 2019       Bart Van Loon <bbb@bbbart.be>
 #
 # 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