private static void ProcessAccept(SocketAsyncEventArgs args) { Socket accepted = null; if (args.SocketError == SocketError.Success) { accepted = args.AcceptSocket; } var epl = (EndPointListener)args.UserToken; Accept(epl._sock, args, ref accepted); if (accepted == null) { return; } if (epl._secure && epl._cert == null) { accepted.Dispose(); return; } var conn = new HttpConnection(accepted, epl, epl._secure, epl._cert); lock (epl._unregistered) { epl._unregistered[conn] = conn; } conn.BeginReadRequest(); }
private static void ProcessAccept(SocketAsyncEventArgs args) { HttpEndPointListener epl = (HttpEndPointListener)args.UserToken; Socket accepted = args.SocketError == SocketError.Success ? args.AcceptSocket : null; epl.Accept(args); if (accepted == null) { return; } if (epl._secure && epl._cert == null) { accepted.Close(); return; } HttpConnection conn = new HttpConnection(accepted, epl, epl._secure, epl._cert); lock (epl._unregisteredConnections) { epl._unregisteredConnections[conn] = conn; } conn.BeginReadRequest(); }
static void OnAccept(object sender, EventArgs e) { SocketAsyncEventArgs args = (SocketAsyncEventArgs)e; EndPointListener epl = (EndPointListener)args.UserToken; Socket accepted = null; if (args.SocketError == SocketError.Success) { accepted = args.AcceptSocket; args.AcceptSocket = null; } try { if (epl.sock != null) { epl.sock.AcceptAsync(args); } } catch { if (accepted != null) { try { accepted.Close(); } catch {} accepted = null; } } if (accepted == null) { return; } if (epl.secure && (epl.cert == null || epl.key == null)) { accepted.Close(); return; } HttpConnection conn = new HttpConnection(accepted, epl, epl.secure, epl.cert, epl.key); epl.unregistered [conn] = conn; conn.BeginReadRequest(); }
private static void OnAccept(IAsyncResult ares) { EndPointListener endPointListener = (EndPointListener)ares.AsyncState; System.Net.Sockets.Socket socket = null; try { socket = endPointListener.sock.EndAccept(ares); } catch { } finally { try { endPointListener.sock.BeginAccept(new AsyncCallback(EndPointListener.OnAccept), endPointListener); } catch { if (socket != null) { try { socket.Close(); } catch { } socket = null; } } } if (socket == null) { return; } if (endPointListener.secure && (endPointListener.cert == null || endPointListener.key == null)) { socket.Close(); return; } HttpConnection httpConnection = new HttpConnection(socket, endPointListener, endPointListener.secure, endPointListener.cert, endPointListener.key); httpConnection.BeginReadRequest(); }
static void OnAccept(IAsyncResult ares) { EndPointListener epl = (EndPointListener)ares.AsyncState; Socket accepted = null; try { accepted = epl.sock.EndAccept(ares); } catch { // Anything to do here? } finally { try { epl.sock.BeginAccept(OnAccept, epl); } catch { if (accepted != null) { try { accepted.Close(); } catch {} accepted = null; } } } if (accepted == null) { return; } if (epl.secure && (epl.cert == null || epl.key == null)) { accepted.Close(); return; } HttpConnection conn = new HttpConnection(accepted, epl, epl.secure, epl.cert, epl.key); conn.BeginReadRequest(); }
static void OnAccept (object sender, EventArgs e) { SocketAsyncEventArgs args = (SocketAsyncEventArgs) e; EndPointListener epl = (EndPointListener) args.UserToken; Socket accepted = null; if (args.SocketError == SocketError.Success) { accepted = args.AcceptSocket; args.AcceptSocket = null; } try { if (epl.sock != null) epl.sock.AcceptAsync (args); } catch { if (accepted != null) { try { accepted.Close (); } catch {} accepted = null; } } if (accepted == null) return; if (epl.secure && (epl.cert == null || epl.key == null)) { accepted.Close (); return; } HttpConnection conn = new HttpConnection (accepted, epl, epl.secure, epl.cert, epl.key); conn.BeginReadRequest (); }
static void OnAccept (IAsyncResult ares) { EndPointListener epl = (EndPointListener) ares.AsyncState; Socket accepted = null; try { if (epl.sock != null) accepted = epl.sock.EndAccept (ares); } catch { // Anything to do here? } finally { try { if (epl.sock != null) epl.sock.BeginAccept (OnAccept, epl); } catch { if (accepted != null) { try { accepted.Close (); } catch {} accepted = null; } } } if (accepted == null) return; if (epl.secure && (epl.cert == null || epl.key == null)) { accepted.Close (); return; } HttpConnection conn = new HttpConnection (accepted, epl, epl.secure, epl.cert, epl.key); conn.BeginReadRequest (); }
static void ProcessAccept (SocketAsyncEventArgs args) { Socket accepted = null; if (args.SocketError == SocketError.Success) accepted = args.AcceptSocket; EndPointListener epl = (EndPointListener) args.UserToken; Accept (epl.sock, args, ref accepted); if (accepted == null) return; if (epl.secure && epl.cert == null) { accepted.Close (); return; } HttpConnection conn = new HttpConnection (accepted, epl, epl.secure, epl.cert); lock (epl.unregistered) { epl.unregistered [conn] = conn; } conn.BeginReadRequest (); }