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 operator, string, random, mmap, os, time
|
||||||
import contrib.pyparsing as pp
|
import contrib.pyparsing as pp
|
||||||
from netlib import http_status
|
from netlib import http_status, tcp
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
BLOCKSIZE = 1024
|
BLOCKSIZE = 1024
|
||||||
@ -43,6 +43,7 @@ def write_values(fp, vals, actions, sofar=0, skip=0, blocksize=BLOCKSIZE):
|
|||||||
|
|
||||||
Return True if connection should disconnect.
|
Return True if connection should disconnect.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
while vals:
|
while vals:
|
||||||
part = vals.pop()
|
part = vals.pop()
|
||||||
for i in range(skip, len(part), blocksize):
|
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)
|
fp.write(d)
|
||||||
sofar += len(d)
|
sofar += len(d)
|
||||||
skip = 0
|
skip = 0
|
||||||
|
except tcp.NetLibDisconnect:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
DATATYPES = dict(
|
DATATYPES = dict(
|
||||||
|
Loading…
Reference in New Issue
Block a user