コード例 #1
0
        private void EnqueueConnection(Guid connectionId, Microsoft.ServiceBus.Channels.IConnection connection, HybridConnectionListener.HybridConnectionSocketType socketType, Action dequeuedCallback)
        {
            HybridConnection hybridConnection;
            bool             flag = false;

            try
            {
                lock (this.connectionTable)
                {
                    if (this.connectionTable.TryGetValue(connectionId, out hybridConnection))
                    {
                        hybridConnection.EnqueueConnection(connection);
                    }
                    else if (socketType != HybridConnectionListener.HybridConnectionSocketType.Direct)
                    {
                        hybridConnection         = new HybridConnection(HybridConnectionRole.Listener, connection, null, this.bufferSize);
                        hybridConnection.Closed += new EventHandler((object o, EventArgs e) => this.connectionTable.Remove(connectionId));
                        flag = true;
                        this.connectionTable.Add(connectionId, hybridConnection);
                    }
                    else
                    {
                        connection.Abort();
                        return;
                    }
                }
                if (flag)
                {
                    this.connectionQueue.EnqueueAndDispatch(hybridConnection);
                }
            }
            finally
            {
                dequeuedCallback();
            }
        }
コード例 #2
0
 public ConnectionAcceptor(HybridConnectionListener connectionListener, Microsoft.ServiceBus.Channels.IConnectionListener socketListener, HybridConnectionListener.HybridConnectionSocketType socketType)
 {
     this.connectionListener = connectionListener;
     this.socketListener     = socketListener;
     this.socketType         = socketType;
 }