gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 2/3] leapsecond.py: set a socket timeout for slow serv


From: Beat Bolli
Subject: [gpsd-dev] [PATCH 2/3] leapsecond.py: set a socket timeout for slow servers.
Date: Thu, 31 Oct 2013 21:11:09 +0100

I have problems connecting to maia.usno.navy.mil, and setting a socket
timeout at least doesn't block the build process.
---
 leapsecond.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/leapsecond.py b/leapsecond.py
index 8e3e88e..d624056 100755
--- a/leapsecond.py
+++ b/leapsecond.py
@@ -48,6 +48,11 @@ BSD terms apply: see the file COPYING in the distribution 
root for details.
 
 import os, urllib, re, random, time, calendar, math, sys
 
+# Set a socket timeout for slow servers
+import socket
+socket.setdefaulttimeout(30)
+del socket
+
 verbose = 0
 
 __locations = [
-- 
1.8.4.rc3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]