mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Handle NetLibDisconnect error.
This commit is contained in:
parent
2cb55ee0f5
commit
1bb93176da
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user