anchor.diff:          (t
            (error "Unsupported element type ~S" element-type))))
   
  +;; Note - must be called on the network queue.
   (defun detach-tcp-connection (connection)
  +  ;; Disarming here is doubly important.
  +  ;; 1) It stops the timer from hanging around if it was active.
  +  ;; 2) If the source handler is pending, then it'll return immediately.
  +  (mezzano.supervisor:timer-disarm (tcp-connection-retransmit-timer connection))
  +  (mezzano.supervisor:timer-disarm (tcp-connection-timeout-timer connection))
  +  (mezzano.sync.dispatch:cancel (tcp-connection-retransmit-source connection))
  +  (mezzano.sync.dispatch:cancel (tcp-connection-timeout-source connection))
     (mezzano.supervisor:with-mutex (*tcp-connection-lock*)
       (setf *tcp-connections* (remove connection *tcp-connections*))))
   
  
positive.code:                (t
                  ;; Aborting connection
                  (tcp4-send-packet connection ack seq nil :rst-p t)
                  (setf (tcp-connection-state connection) :connection-aborted)
                  (detach-tcp-connection connection)
                  (when (and listener
                             (tcp-listener-backlog listener))
  
negative.code: (define-condition connection-timed-out (connection-error)
    ())
  
  (defun check-connection-error (connection)
    (let ((condition (tcp-connection-pending-error connection)))
      (when condition
        (error condition))))
  
  (defun tcp-connect (ip port &key persist)
    (let* ((interface (nth-value 1 (mezzano.network.ip:ipv4-route ip)))
           (source-address (mezzano.network.ip:ipv4-interface-address interface))
           (source-port (allocate-local-tcp-port source-address ip port))
           (seq (random #x100000000))
           (connection (make-instance 'tcp-connection
                                      :state :syn-sent
                                      :local-port source-port
                                      :local-ip source-address
                                      :remote-port port
                                      :remote-ip ip
                                      :s-next (logand #xFFFFFFFF (1+ seq))
                                      :r-next 0
                                      :window-size 8192
                                      :boot-id (if persist nil (mezzano.supervisor:current-boot-id)))))
      (mezzano.sync.dispatch:dispatch-async
       (lambda ()
         (mezzano.supervisor:with-mutex (*tcp-connection-lock*)
           (push connection *tcp-connections*))
         (tcp4-send-packet connection seq 0 nil :ack-p nil :syn-p t)
         (arm-retransmit-timer 1 connection)
         (arm-timeout-timer *tcp-connect-timeout* connection))
       sys.net::*network-serial-queue*)
      (with-tcp-connection-locked connection
        (mezzano.supervisor:condition-wait-for ((tcp-connection-cvar connection)
                                                (tcp-connection-lock connection))
          (not (eql (tcp-connection-state connection) :syn-sent)))
        (check-connection-error connection))
      connection))
  
  (defun tcp-send (connection data &optional (start 0) end)
    (when (or (eql (tcp-connection-state connection) :established)
  