'Overridden twisted callback which is called when the
connection goes away (cleanly or otherwise).
It should be safe to call defunct() here instead of just close, because
we can assume that if the connection was closed cleanly, there are no
requests to error out. If this assumption turns out to be false, we
can call close() instead of defunct() when "reason" is an appropriate
type.'

def clientConnectionLost(self, connector, reason):

    log.debug('Connect    lost:    %s', reason)
    self.conn.defunct(reason.value)
