         self.state = .Starting
         self.socket = try Socket.tcpSocketForListen(port, forceIPv4: forceIPv4)
         dispatch_async(dispatch_get_global_queue(priority, 0)) { [weak self] in
-            guard let sself = self else { return }
-            guard sself.operating else { return }
-            while let socket = try? sself.socket.acceptClientSocket() {
+            guard let `self` = self else { return }
+            guard self.operating else { return }
+            while let socket = try? self.socket.acceptClientSocket() {
                 dispatch_async(dispatch_get_global_queue(priority, 0), { [weak self] in
-                    guard let sself = self else { return }
-                    guard sself.operating else { return }
-                    sself.sockets.insert(socket)
-                    sself.handleConnection(socket)
-                    sself.sockets.remove(socket)
+                    guard let `self` = self else { return }
+                    guard self.operating else { return }
+                    dispatch_async(self.queue) {
+                        self.sockets.insert(socket)
+                    }
+                    self.handleConnection(socket)
+                    dispatch_async(self.queue) {
+                        self.sockets.remove(socket)
+                    }
                 })
             }
-            sself.stop()
+            self.stop()
         }
         self.state = .Running
     }

    
    private var socket = Socket(socketFileDescriptor: -1)
    private var sockets = Set<Socket>()
    public private(set) var state = HttpServerIOState.Stopped
    public var operating: Bool { get { return self.state == .Running } }
    
    public func port() throws -> Int {
        return Int(try socket.port())

    }
}

public enum HttpServerIOState: Int32 {
    case Starting
    case Running
    case Stopping
