internal abstract void BeginReconnect(ClientSocketConnection connection);
/// <summary> /// Reconnects the connection adjusting the reconnect timer. /// </summary> /// <param name="connection"> /// Connection. /// </param> /// <param name="sleepTimeOutValue"> /// Sleep timeout before reconnect. /// </param> internal override void BeginReconnect(ClientSocketConnection connection) { if (!Disposed) { if (connection != null) { SocketConnector connector = (SocketConnector)connection.Context.Creator; if (connector != null) { connector.ReconnectConnection(true, null); } } } }
/// <summary> /// Connect callback! /// </summary> /// <param name="ar"></param> internal void BeginConnectCallbackAsync(object sender, SocketAsyncEventArgs e) { if (!Disposed) { BaseSocketConnection connection = null; SocketConnector connector = null; Exception exception = null; if (e.SocketError == SocketError.Success) { try { connector = (SocketConnector)e.UserToken; connection = new ClientSocketConnection(Context.Host, connector, connector.Socket); //----- Adjust buffer size! connector.Socket.ReceiveBufferSize = Context.Host.Context.SocketBufferSize; connector.Socket.SendBufferSize = Context.Host.Context.SocketBufferSize; ; //----- Initialize! Context.Host.AddSocketConnection(connection); connection.Active = true; Context.Host.InitializeConnection(connection); } catch (Exception ex) { exception = ex; if (connection != null) { Context.Host.DisposeConnection(connection); Context.Host.RemoveSocketConnection(connection); connection = null; } } } else { exception = new SocketException((int)e.SocketError); } if (exception != null) { FReconnectAttempted++; ReconnectConnection(false, exception); } } e.UserToken = null; e.Dispose(); e = null; }
internal override void BeginReconnect(ClientSocketConnection connection) { }