 
         onConnError = @_onConnectionError.bind this, imap
         imap.connectionID = 'conn' + connectionID++
+        imap.connectionName = "#{options.host}:#{options.port}"
 
         imap.on 'error', onConnError
         imap.once 'ready', =>



    _onConnectionError: (connection, err) ->
        log.debug @id, "connection error"
        # we failed to establish a new connection
        @connecting--
        @failConnectionCounter++

        process.nextTick @_deQueue

    _onActiveError: (connection, err) ->
        log.error "error on active imap socket on #{connection.connectionName}", err.stack
        @_removeFromPool connection
        try connection.destroy()

    _onActiveClose: (connection, err) ->
        log.error "active connection #{connection.connectionName} closed", err.stack
        task = @pending[connection.connectionID]
        if task
            delete @pending[connection.connectionID]
