internal void SocketClosed(DefaultKayakSocket socket) { //NPx.Log.Debug("Connection " + socket.id + ": closed (" + connections + " active connections)"); if (state.DecrementConnections()) { RaiseOnClose(); } }
void AcceptNext() { try { NPx.Log.Debug("KayakServer: accepting connection"); listener.BeginAccept(iasr => { NPx.Log.Debug("KayakServer: accepted connection callback"); Socket socket = null; Exception error = null; try { socket = listener.EndAccept(iasr); AcceptNext(); } catch (Exception e) { error = e; } if (error is ObjectDisposedException) { return; } scheduler.Post(() => { NPx.Log.Debug("KayakServer: accepted connection"); if (error != null) { HandleAcceptError(error); } var s = new DefaultKayakSocket(new SocketWrapper(socket), this.scheduler); state.IncrementConnections(); var socketDelegate = del.OnConnection(this, s); s.del = socketDelegate; s.BeginRead(); }); }, null); } catch (ObjectDisposedException) { return; } catch (Exception e) { HandleAcceptError(e); } }
void AcceptNext() { try { Debug.WriteLine("KayakServer: accepting connection"); listener.BeginAccept(iasr => { Debug.WriteLine("KayakServer: accepted connection callback"); Socket socket = null; Exception error = null; try { socket = listener.EndAccept(iasr); AcceptNext(); } catch (Exception e) { error = e; } if (error is ObjectDisposedException) return; scheduler.Post(() => { Debug.WriteLine("KayakServer: accepted connection"); if (error != null) HandleAcceptError(error); var s = new DefaultKayakSocket(new SocketWrapper(socket), this.scheduler); state.IncrementConnections(); var socketDelegate = del.OnConnection(this, s); s.del = socketDelegate; s.BeginRead(); }); }, null); } catch (ObjectDisposedException) { return; } catch (Exception e) { HandleAcceptError(e); } }
internal void SocketClosed(DefaultKayakSocket socket) { //Debug.WriteLine("Connection " + socket.id + ": closed (" + connections + " active connections)"); if (state.DecrementConnections()) RaiseOnClose(); }