dmorlitz / pygooglevoice

Automatically exported from code.google.com/p/pygooglevoice
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

When google voice URL doesn't work, gvoice sits and never times out #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Google voice service URL is down, or unreachable
2. run gvoice
3. it sits there forever

What is the expected output? What do you see instead?
Nothing, it hangs

What version of the product are you using? On what operating system?
0.5 on Linux with asterisk

Please provide any additional information below.

So Google Voice for some reason wasn't working today, and gvoice just hung and 
set there at the voice.login() function forever.  I think I found the solution, 
it's because by default the urllib2 doesn't have the socket timeout set so it's 
indefinite.  To fix this, I think the simple solution is to set the timeout for 
the socket connections.  Saw this solution on this site 
http://www.voidspace.org.uk/python/articles/urllib2.shtml.  I basically added 
the following to the top of gvoice, but in voice.py it may also be added to 
make it insid

---
import socket

timeout = 10
socket.setdefaulttimeout(timeout)

---

Thanks,
Chris

Original issue reported on code.google.com by bitbyte...@gmail.com on 7 Aug 2010 at 9:43