THRIFT-5084: Multiplexed processor in Swift
Client: Swift
Patch: Alexander Edge

This closes #2002
diff --git a/lib/swift/Sources/TSocketServer.swift b/lib/swift/Sources/TSocketServer.swift
index 7367c7e..a3c6389 100644
--- a/lib/swift/Sources/TSocketServer.swift
+++ b/lib/swift/Sources/TSocketServer.swift
@@ -31,20 +31,22 @@
 public let TSocketServerProcessorKey = "TSocketServerProcessor"
 public let TSocketServerTransportKey = "TSocketServerTransport"
 
-class TSocketServer<InProtocol: TProtocol, OutProtocol: TProtocol, Processor: TProcessor, Service> where Processor.Service == Service {
+class TSocketServer<InProtocol: TProtocol, OutProtocol: TProtocol, Processor: TProcessor, Service> {
   var socketFileHandle: FileHandle
   var processingQueue =  DispatchQueue(label: "TSocketServer.processing",
                                        qos: .background,
                                        attributes: .concurrent)
   var serviceHandler: Service
+  let processor: Processor
 
   public init(port: Int,
               service: Service,
               inProtocol: InProtocol.Type,
               outProtocol: OutProtocol.Type,
-              processor: Processor.Type) throws {
+              processor: Processor) throws {
     // set service handler
     self.serviceHandler = service
+    self.processor = processor
 
     // create a socket
     var fd: Int32 = -1
@@ -127,7 +129,6 @@
   func handleClientConnection(_ clientSocket: FileHandle) {
 
     let transport = TFileHandleTransport(fileHandle: clientSocket)
-    let processor = Processor(service: serviceHandler)
 
     let inProtocol = InProtocol(on: transport)
     let outProtocol = OutProtocol(on: transport)
@@ -141,7 +142,7 @@
       NotificationCenter.default
         .post(name: Notification.Name(rawValue: TSocketServerClientConnectionFinished),
               object: self,
-              userInfo: [TSocketServerProcessorKey: processor,
+              userInfo: [TSocketServerProcessorKey: self.processor,
                          TSocketServerTransportKey: transport])
     }
   }