private void MultiLineResponseCallback(IAsyncResult asyncResult) { DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState; try { int num = state.DataStream.EndRead(asyncResult); if (num > 0) { state.AppendReceivedData(num); if (!this.LastLineReceived(state.Response)) { state.BeginRead(); return; } } } catch (InvalidOperationException exception) { if (base.Communicator.HasTimedOut) { base.Communicator.HandleException(DataCommunicator.CreateTimeoutException()); return; } base.Communicator.HandleException(exception); } catch (IOException exception2) { base.Communicator.HandleException(exception2); return; } base.Communicator.StopTimer(); state.LaunchResponseDelegate(); }
protected void SingleLineResponseCallback(IAsyncResult asyncResult) { DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState; try { int num = state.DataStream.EndRead(asyncResult); if (num > 0) { state.AppendReceivedData(num); if (!state.Response.EndsWith("\r\n", StringComparison.Ordinal)) { state.BeginRead(); } } this.Communicator.StopTimer(); state.LaunchResponseDelegate(); } catch (InvalidOperationException exception) { if (this.Communicator.HasTimedOut) { this.Communicator.HandleException(DataCommunicator.CreateTimeoutException()); } else { this.Communicator.HandleException(exception); } } catch (IOException exception2) { this.Communicator.HandleException(exception2); } }
private void InitializeSecureStreamAsyncCallback(IAsyncResult asyncResult) { DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState; try { SslStream sslStream = (SslStream)state.DataStream; sslStream.EndAuthenticateAsClient(asyncResult); if (this.connectionType == ProtocolConnectionType.Ssl) { state.BeginRead(); } else { state.LaunchResponseDelegate(); } } catch (IOException ex) { this.HandleException(new ProtocolException(Strings.ErrorAuthenticationFailed(ex.Message) + Strings.InitializeServerResponse(string.IsNullOrEmpty(state.Response) ? string.Empty : state.Response), ex)); } catch (InvalidOperationException innerException) { this.HandleException(new ProtocolException(Strings.ErrorAuthentication + Strings.InitializeServerResponse(string.IsNullOrEmpty(state.Response) ? string.Empty : state.Response), innerException)); } catch (AuthenticationException innerException2) { this.HandleException(new ProtocolException(Strings.ErrorAuthenticationFailed(this.certificateError) + Strings.InitializeServerResponse(string.IsNullOrEmpty(state.Response) ? string.Empty : state.Response), innerException2)); } }
internal void MultiLineResponseCallback(IAsyncResult asyncResult) { DataCommunicator.State state = (DataCommunicator.State)asyncResult.AsyncState; try { int num = state.DataStream.EndRead(asyncResult); if (num > 0) { state.AppendReceivedData(num); if (!PopClient.IsOkResponse(state.Response)) { if (!state.Response.EndsWith("\r\n", StringComparison.Ordinal)) { state.ReadDataCallback = new AsyncCallback(base.SingleLineResponseCallback); state.BeginRead(); return; } } else { bool flag = false; if (!state.Response.EndsWith("\r\n.\r\n", StringComparison.Ordinal)) { flag = true; } if (flag) { state.BeginRead(); return; } } } } catch (InvalidOperationException exception) { if (base.Communicator.HasTimedOut) { base.Communicator.HandleException(DataCommunicator.CreateTimeoutException()); return; } base.Communicator.HandleException(exception); } catch (IOException exception2) { base.Communicator.HandleException(exception2); return; } base.Communicator.StopTimer(); state.LaunchResponseDelegate(); }