Handle NetLibDisconnect error.

This commit is contained in:
Aldo Cortesi 2012-07-09 11:09:37 +12:00
parent 2cb55ee0f5
commit 1bb93176da

View File

@ -1,6 +1,6 @@
import operator, string, random, mmap, os, time
import contrib.pyparsing as pp
from netlib import http_status
from netlib import http_status, tcp
import utils
BLOCKSIZE = 1024
@ -43,6 +43,7 @@ def write_values(fp, vals, actions, sofar=0, skip=0, blocksize=BLOCKSIZE):
Return True if connection should disconnect.
"""
try:
while vals:
part = vals.pop()
for i in range(skip, len(part), blocksize):
@ -66,6 +67,8 @@ def write_values(fp, vals, actions, sofar=0, skip=0, blocksize=BLOCKSIZE):
fp.write(d)
sofar += len(d)
skip = 0
except tcp.NetLibDisconnect:
return True
DATATYPES = dict(