private void SetupClient() { if (client != null) client.Disconnect(); var socket = GetSocket(); socket.Connect(); protocol = new KestrelProtocol(socket); client = new KestrelClient(protocol); }
private KestrelClient CreateClient() { WrappedSocket socket = GetSocket(); var protocol = new KestrelProtocol(socket); var client = new KestrelClient(protocol); client.Connect(); return client; }
protected KestrelClient CreateServer(IPEndPoint endpoint) { var socket = new WrappedSocket(endpoint, _configuration.SendReceiveTimeout); var protocol = new KestrelProtocol(socket); var server = new KestrelClient(protocol); return server; }
public ServerWrapper(ServerPool pool, KestrelClient client) { _pool = pool; Client = client; }
public void Release(KestrelClient client) { if (client.IsTainted || ! client.IsAlive || _isDisposed) { using (client) { client.Disconnect(); } return; } // client should be ok, return it to the pool var endpoint = client.Protocol.Socket.EndPoint; var serverInfo = GetServerInfoByEndPoint(endpoint); lock (serverInfo) { if (serverInfo.Queue.Count > this._configuration.MaxConnections) { using (client) { client.Disconnect(); } } else { serverInfo.Queue.Enqueue(client); } } }