Beispiel #1
0
        void _listener_IncomingConnection(object sender, IncomingConnectionEventArgs e)
        {
            Logger.Info("Incoming connection");

            var connection = new HyperServerConnection(e.Socket);

            connection.Handshake += connection_Handshake;
            connection.ConnectionStatusChanged += connection_ConnectionStatusChanged;
            lock (_unknownConnections)
                _unknownConnections.Add(connection);

            connection.StartAsync();
            e.Handled = true;
        }
Beispiel #2
0
        public void AddConnection(HyperServerConnection connection)
        {
            if (connection.IsControl)
            {
                lock (_controlConnections)
                    _controlConnections.Add(connection);

                connection.SegmentRequested += connection_SegmentRequested;
            }
            else
            {
                lock (_transferConnections)
                    _transferConnections.Add(connection);
            }

            connection.ConnectionStatusChanged += connection_ConnectionStatusChanged;
            connection.SetResponsesRovider(this);
        }