     // The whole stack is running in this dispatch queue.
     let processQueue = dispatch_queue_create("tun2socks.IPStackQueue", DISPATCH_QUEUE_SERIAL)!
 
-    let timer: dispatch_source_t
+    var timer: dispatch_source_t?
     let listenPCB: UnsafeMutablePointer<tcp_pcb>
 
     /// When the IP stack decides to output some IP packets, this block is called.

        tcp_accept(pcb, tcpAcceptFn)

        interface.memory.output = outputPCB

        // note the default tcp_tmr interval is 250 ms.
        // I don't know the best way to set leeway.
        dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, NSEC_PER_SEC / 4, NSEC_PER_SEC / 4)
        dispatch_source_set_event_handler(timer) {
            [weak self] in
            self?.checkTimeout()
        }
        dispatch_resume(timer)
    }

    private func checkTimeout() {

    private init() {
        lwip_init()

        // add a listening pcb
        var pcb = tcp_new()
        var addr = ip_addr_any
