def connectionLost(self, reason): """ Cleans up reply channel on close. """ if self.reply_channel: del self.channel.factory.reply_protocols[self.reply_channel] Request.connectionLost(self, reason)