Ticket #3420: persistent_connection_no_leak.diff
File persistent_connection_no_leak.diff, 1.1 KB (added by , 7 years ago) |
---|
-
twisted/web/client.py
785 785 """ 786 786 protos = self._protocolCache.setdefault((scheme, host, port), []) 787 787 maybeDisconnected = False 788 while protos: 789 # connection exists 790 p = protos.pop(0) 788 d = None 789 for p in protos: 791 790 if p.state == 'QUIESCENT': 791 # available existing connection 792 792 d = defer.succeed(p) 793 793 maybeDisconnected = True 794 794 break 795 else:795 if not d: 796 796 # new connection 797 797 d = self._connect(scheme, host, port) 798 798 req = Request(method, path, headers, bodyProducer, 799 799 persistent=self.persistent) 800 800 801 801 def saveProtocol(response, proto): 802 if self.persistent :802 if self.persistent and proto not in protos: 803 803 protos.append(proto) 804 804 return response 805 805