     }
     
     override func start(listenPort: in_port_t) throws {
-        let listenSocket = try Socket.tcpSocketForListen(listenPort)
-        dispatchSource = createDispatchSource(listenSocket.socketFileDescriptor)
+        dispatchSource = createDispatchSource(try Socket.tcpSocketForListen(listenPort))
         guard let source = dispatchSource else {
             throw punosError(0, "Could not create dispatch source")
         }

        
        dispatch_source_set_event_handler(source) { _ in
            autoreleasepool {
                var remoteSockAddr = sockaddr()
                var remoteSockAddrLen: socklen_t = 0
                let clientSocket = accept(listeningSocketFD, &remoteSockAddr, &remoteSockAddrLen)
                guard 0 < clientSocket else {
                    self.log("Failed to accept socket: \(String(strerror(errno)))")
                    return
                }
                
                Socket.setNoSigPipe(clientSocket)
                
                dispatch_async(self.queue) {
                    self.handleConnection(Socket(socketFileDescriptor: clientSocket))
                    Socket.release(clientSocket)
                }
            }
        }

    private let sourceGroup = dispatch_group_create()
    private var dispatchSource: dispatch_source_t?
    
    private func createDispatchSource(listeningSocket: Socket) -> dispatch_source_t {
        let listeningSocketFD = listeningSocket.socketFileDescriptor
        dispatch_group_enter(sourceGroup)
        let source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, UInt(listeningSocketFD), 0, queue)
        
