protected StateTransition TransitState(string operation, StateTransition[] states) { StateTransition stateTransition = null; lock (this.ThisLock) { StateTransition[] stateTransitionArray = states; int num = 0; while (num < (int)stateTransitionArray.Length) { StateTransition stateTransition1 = stateTransitionArray[num]; if (stateTransition1.From != this.State) { num++; } else { this.State = stateTransition1.To; stateTransition = stateTransition1; break; } } } if (stateTransition == null) { throw new AmqpException(AmqpError.IllegalState, SRAmqp.AmqpIllegalOperationState(operation, this.State)); } MessagingClientEtwProvider.TraceClient <AmqpObject, string, StateTransition>((AmqpObject source, string op, StateTransition st) => { }, this, operation, stateTransition); return(stateTransition); }
private void OnSaslInit(SaslInit init) { if (this.state != SaslNegotiator.SaslState.WaitingForInit) { throw new AmqpException(AmqpError.IllegalState, SRAmqp.AmqpIllegalOperationState("R:SASL-INIT", this.state)); } this.state = SaslNegotiator.SaslState.Negotiating; SaslTransportProvider saslTransportProvider = this.provider; AmqpSymbol mechanism = init.Mechanism; this.saslHandler = saslTransportProvider.GetHandler(mechanism.Value, true); this.saslHandler.Start(this, init, false); }
private void OnSaslServerMechanisms(SaslMechanisms mechanisms) { if (this.state != SaslNegotiator.SaslState.WaitingForServerMechanisms) { throw new AmqpException(AmqpError.IllegalState, SRAmqp.AmqpIllegalOperationState("R:SASL-MECH", this.state)); } string str = null; using (IEnumerator <string> enumerator = this.provider.Mechanisms.GetEnumerator()) { do { if (!enumerator.MoveNext()) { break; } string current = enumerator.Current; if (!mechanisms.SaslServerMechanisms.Contains(new AmqpSymbol(current))) { continue; } str = current; break; }while (str == null); } if (str == null) { throw new AmqpException(AmqpError.NotFound, SRAmqp.AmqpNotSupportMechanism); } this.state = SaslNegotiator.SaslState.Negotiating; this.saslHandler = this.provider.GetHandler(str, true); SaslInit saslInit = new SaslInit() { Mechanism = str }; this.saslHandler.Start(this, saslInit, true); }