mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
socket: retry on EAGAIN
This commit is contained in:
parent
1650eefdd3
commit
803b292d9d
1 changed files with 11 additions and 5 deletions
|
@ -17,7 +17,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import random, socket, ast, re, ssl
|
import random, socket, ast, re, ssl, errno
|
||||||
import threading, traceback, sys, time, json, Queue
|
import threading, traceback, sys, time, json, Queue
|
||||||
|
|
||||||
from version import ELECTRUM_VERSION, PROTOCOL_VERSION
|
from version import ELECTRUM_VERSION, PROTOCOL_VERSION
|
||||||
|
@ -404,10 +404,16 @@ class Interface(threading.Thread):
|
||||||
try:
|
try:
|
||||||
sent = self.s.send( out )
|
sent = self.s.send( out )
|
||||||
out = out[sent:]
|
out = out[sent:]
|
||||||
except:
|
except socket.error,e:
|
||||||
# this happens when we get disconnected
|
if e[0] in (errno.EWOULDBLOCK,errno.EAGAIN):
|
||||||
print_error( "Not connected, cannot send" )
|
print_error( "EAGAIN: retrying")
|
||||||
return None
|
time.sleep(0.1)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
traceback.print_exc(file=sys.stdout)
|
||||||
|
# this happens when we get disconnected
|
||||||
|
print_error( "Not connected, cannot send" )
|
||||||
|
return None
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue