Example #1
0
        private void DisconnectNotifyBroadcast(string disconnectedKey, Connection disconnected,
                                               string initiatorUniqueKey, List <Connection> clients, string reason,
                                               bool kill)
        {
            BroadcastsChannel.ConnectDisconnected(disconnectedKey, initiatorUniqueKey,
                                                  clients, reason, kill);

            var cC = disconnected.ServerChannel as ICommunicationObject;

            if (cC != null && cC.State == CommunicationState.Opened)
            {
                // the following cC.Close(); will interrupt overall broadcasting
                //      therefore disconnected should be notified personally
                try
                {
                    disconnected.BroadcastChannel <T>().ConnectDisconnected(disconnectedKey, initiatorUniqueKey,
                                                                            clients, reason, kill);
                }
                catch (SystemException)
                {
                }

                // closing is vital because without closing client will be only notified
                //      but it can continue to work
                Channels.CloseChannel(ref cC);
            }
            //was Unsubscribe(null, (T) disconnected.ServerChannel); in 1.0.0.0
        }
Example #2
0
 public override void BeforeCloseChannel()
 {
     if (Settings.ClientType != ClientType.SendAndReceiver_WithoutChat)
     {
         Channels.CloseChannel(ref _chatMessagesChannel);
         Channels.CloseFactory(ref ChatMessagesChannelFactory);
     }
     base.BeforeCloseChannel();
 }
Example #3
0
        public void CloseFactories()
        {
            if (ClientStatus == ClientStatus.Connected)
            {
                new DisconnectCommand <MT, T>(true).ExecuteSafe(this, null);
            }
            else
            {
                ClientStatus = ClientStatus.NotConnected;
            }

            BeforeCloseChannel();

            Channels.CloseChannel(ref _mainChannel);
            Channels.CloseFactory(ref MainChannelFactory);

            if (BroadcastChannels != null)
            {
                BroadcastChannels.Dispose();
                BroadcastChannels = null;
            }
        }