 
         @rawSocket.on 'close', => @open = false; @emit 'close'
 
-    close: ar () ->
-        @open = false
+    close: () ->
+        super()
         @rawSocket.end()
 
-    cancel: ar () ->
-        @outstandingCallbacks = {}
+    cancel: () ->
         @rawSocket.destroy()
+        super()
 
     write: (chunk) ->
         # Alas we must convert to a node buffer

        super(host, callback)

        if @rawSocket?
            @rawSocket.end()

        net = require('net')
        @rawSocket = net.connect @port, @host

    close: ar () ->
        @open = false

    cancel: ar () ->
        @outstandingCallbacks = {}

    reconnect: ar (callback) ->
        setTimeout(
            () => @constructor.call(@, {host:@host, port:@port}, callback)
           ,0)

    use: ar (db) ->
        @db = db
