/// <summary> /// Initializes the session object. /// </summary> /// <param name="type">A prefix to the session name for debugging purposes.</param> /// <param name="connection">The connection in which the session is created.</param> /// <param name="settings">The session settings.</param> /// <param name="linkFactory">The factory to create <see cref="AmqpLink"/> objects when an <see cref="Attach"/> frame is received.</param> protected AmqpSession(string type, AmqpConnection connection, AmqpSessionSettings settings, ILinkFactory linkFactory) : base(type) { Fx.Assert(connection != null, "connection must not be null"); Fx.Assert(settings != null, "settings must not be null"); this.connection = connection; this.settings = settings; this.linkFactory = linkFactory; this.State = AmqpObjectState.Start; this.links = new Dictionary <string, AmqpLink>(); this.linksByLocalHandle = new HandleTable <AmqpLink>(settings.HandleMax ?? AmqpConstants.DefaultMaxLinkHandles - 1); this.linksByRemoteHandle = new HandleTable <AmqpLink>(settings.HandleMax ?? AmqpConstants.DefaultMaxLinkHandles - 1); this.outgoingChannel = new OutgoingSessionChannel(this); this.incomingChannel = new IncomingSessionChannel(this); }
public AmqpConnection(TransportBase transport, ProtocolHeader protocolHeader, bool isInitiator, AmqpSettings amqpSettings, AmqpConnectionSettings connectionSettings) : base((isInitiator ? "out" : "in") + "-connection", transport, connectionSettings, isInitiator) { if (amqpSettings == null) { throw new ArgumentNullException("amqpSettings"); } this.initialHeader = protocolHeader; this.isInitiator = isInitiator; this.amqpSettings = amqpSettings; this.sessionsByLocalHandle = new HandleTable <AmqpSession>(this.Settings.ChannelMax ?? AmqpConstants.DefaultMaxConcurrentChannels - 1); this.sessionsByRemoteHandle = new HandleTable <AmqpSession>(this.Settings.ChannelMax ?? AmqpConstants.DefaultMaxConcurrentChannels - 1); this.SessionFactory = this; this.heartBeat = HeartBeat.None; }
public SafeEnumerator(HandleTable <T> table) { this.table = table; this.index = -1; }