コード例 #1
0
        /**
         * This Handler should be connected to incoming EdgeEvent
         * events.  If it is not, it cannot hear the new edges.
         *
         * When a new edge is created, we make sure we can hear
         * the packets from it.  Also, we make sure we can hear
         * the CloseEvent.
         *
         * @param edge the new Edge
         */
        protected void EdgeHandler(object edge, EventArgs args)
        {
            Edge e = (Edge)edge;

            try {
                _connection_table.AddUnconnected(e);
                e.Subscribe(this, e);
            }
            catch (TableClosedException) {
                /*
                 * Close this edge immediately, before any packets
                 * have a chance to be received.  We are shutting down,
                 * and it is best that we stop getting new packets
                 */
                e.Close();
            }
        }