[PATCH] keepalive: handle broken pipes gracefully during large POSTs

Augie Fackler durin42 at gmail.com
Thu Nov 5 07:51:16 CST 2009


On Nov 5, 2009, at 5:08 AM, Dirkjan Ochtman wrote:

> On Mon, Nov 2, 2009 at 19:30,  <durin42 at gmail.com> wrote:
>> # HG changeset patch
>> # User Augie Fackler <durin42 at gmail.com>
>> # Date 1257177802 18000
>> # Node ID 38e263556f1dfd4071c84fc6415aa149b5195259
>> # Parent  8269fe2d48f6caa7808242803d64b7415ba0745a
>> keepalive: handle broken pipes gracefully during large POSTs
>>
>> diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
>> --- a/mercurial/keepalive.py
>> +++ b/mercurial/keepalive.py
>> @@ -495,10 +499,62 @@
>>                 break
>>         return list
>>
>> +def safesend(self, str):
>> +    """Send `str' to the server.
>> +
>> +    Shamelessly ripped off from httplib to patch a bad behavior.
>> +    """
>> +    if getattr(self, '_broken_pipe_resp', None) is not None:
>> +        return
>
> I'm confused by this, since in Python trunk's httplib there's no
> mention of _broken_pipe...

Right - safesend is httplib.HTTPConnection.send() with some extra code  
added to make it less fragile in the presence of broken pipes. The  
_broken_pipe_resp is to hold a response that came in when a pipe got  
broken. Should I add more comments to that effect?

Peace,
Augie

>
> Cheers,
>
> Dirkjan



More information about the Mercurial-devel mailing list