Beispiel #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
        }