         ).nodeify callback
 
     cancel: ar () ->
+        response = {t:protoResponseType.RUNTIME_ERROR,r:["Connection is closed."],b:[]}
+        for own key, value of @outstandingCallbacks
+            if value.cursor?
+                value.cursor._addResponse(response)
+            else if value.feed?
+                value.feed._addResponse(response)
+            else if value.cb?
+                value.cb mkErr(err.RqlRuntimeError, response, value.root)
+
         @outstandingCallbacks = {}
 
     reconnect: (varar 0, 2, (optsOrCallback, callback) ->

    _delQuery: (token) ->
        # This query is done, delete this cursor
        delete @outstandingCallbacks[token]

        if Object.keys(@outstandingCallbacks).length < 1 and not @open
            @cancel()

    _processResponse: (response, token) ->
        profile = response.p


            @rawSocket.on 'data', handshake_callback

        @rawSocket.on 'error', (args...) =>
            @close({noreplyWait:false})
            @emit 'close'

        @rawSocket.on 'close', =>
            @close({noreplyWait: false})
            @emit 'close'

        # In case the raw socket timesout, we close it and re-emit the event for the user
        @rawSocket.on 'timeout', => @open = false; @emit 'timeout'
