Example #1
0
 public NetworkClient(NetworkConnection connection)
 {
     Connection  = connection;
     State       = ConnectionState.Closed;
     Behavior    = ConnectionBehavior.None;
     CloseReason = ConnectionClosedReason.NeverOpened;
 }
Example #2
0
 public void SetBehavior(string behavior)
 {
     if (Enum.TryParse(behavior, true, out ConnectionBehavior b))
     {
         connectionBehavior = b;
         Clients.Group(SuperviserGroupName).InvokeAsync(MethodServer, "Behavior",
                                                        $"SignalR server behavior changed to: { b.ToString()}");
     }
 }
Example #3
0
 private void EnterStateListening()
 {
     CloseReason = ConnectionClosedReason.None;
     State       = ConnectionState.Listening;
     if (BehaviorSet(ConnectionBehavior.GenerateOutgoingHandshakes))
     {
         Connection.Enqueue(HandshakePayload.Generate(State, false));
     }
     Behavior = ConnectionBehavior.HandleIncomingHandshakesOnly;
 }
Example #4
0
 private void EnterStateClosed(ConnectionClosedReason reason)
 {
     CloseReason = reason;
     State       = ConnectionState.Closed;
     if (BehaviorSet(ConnectionBehavior.GenerateOutgoingHandshakes))
     {
         // If we have just come from a state where handshakes are required, then we should notify the endpoint that we are closing.
         Connection.Enqueue(HandshakePayload.Generate(State, false));
     }
     Behavior = ConnectionBehavior.None;
 }
Example #5
0
        private void EnterStateOpen()
        {
            CloseReason = ConnectionClosedReason.None;
            State       = ConnectionState.Open;
            Behavior    = ConnectionBehavior.AllowOutgoingPayloads
                          | ConnectionBehavior.HandleIncomingPayloads
                          | ConnectionBehavior.GenerateOutgoingHandshakes
                          | ConnectionBehavior.CloseOnTimeout;

            EnqueueSetupPayloads();
        }
Example #6
0
        private void EnterStateOpening()
        {
            CloseReason = ConnectionClosedReason.None;
            State       = ConnectionState.Opening;
            Behavior    = ConnectionBehavior.GenerateOutgoingHandshakes
                          | ConnectionBehavior.HandleIncomingPayloads
                          | ConnectionBehavior.CloseOnTimeout;

            // Kick the connection off.
            EnqueueHandshake(true);
            KeepAliveMarker.Mark();
            ClearIncomingSyncPools();
        }
Example #7
0
        public ConnectionAdorner(Canvas designerCanvas, ConnectionBehavior connectionBehavior) : base(designerCanvas)
        {
            this._designerCanvas = designerCanvas;

            this._behavior = connectionBehavior;

            this._connector  = _behavior.Connector;
            this._connection = _connector.Connection;
            this._connection.StrokeDashArray = new DoubleCollection(new double[] { 4, 2 });

            this._drawingPen           = new Pen(Brushes.LightSlateGray, 1);
            this._drawingPen.LineJoin  = PenLineJoin.Round;
            this._drawingPen.DashStyle = DashStyles.Solid;

            Cursor = Cursors.Cross;
        }
Example #8
0
 public void SetConnectionBehavior(ConnectionBehavior behavior)
 {
     PerfConnection.Behavior = behavior;
     Console.WriteLine("Connection behavior set to: " + behavior.ToString());
     Clients.Others.connectionBehaviorChanged(((int)behavior).ToString());
 }
Example #9
0
 public void SetConnectionBehavior(ConnectionBehavior behavior)
 {
     TestConnection.Behavior = behavior;
     Clients.Others.connectionBehaviorChanged(((int)behavior).ToString());
 }
Example #10
0
 [MethodImpl(256)] // Set for aggressive inlining.
 private bool BehaviorSet(ConnectionBehavior behavior)
 {
     return((Behavior & behavior) != 0);
 }
Example #11
0
 public void SetConnectionBehavior(ConnectionBehavior behavior)
 {
     TestConnection.Behavior = behavior;
     Clients.Others.connectionBehaviorChanged(((int)behavior).ToString());
 }