Exemple #1
0
        protected override bool RecordOpenedSocket(Socket sock)
        {
            ThreadTrackingStatistic.FirstClientConnectedStartTracking();
            GrainId client;

            if (!ReceiveSocketPreample(sock, true, out client))
            {
                return(false);
            }

            // refuse clients that are connecting to the wrong cluster
            if (client.Category == UniqueKey.Category.GeoClient)
            {
                if (client.Key.ClusterId != Silo.CurrentSilo.ClusterId)
                {
                    Log.Error(ErrorCode.GatewayAcceptor_WrongClusterId,
                              string.Format(
                                  "Refusing connection by client {0} because of cluster id mismatch: client={1} silo={2}",
                                  client, client.Key.ClusterId, Silo.CurrentSilo.ClusterId));
                    return(false);
                }
            }
            else
            {
                //convert handshake cliendId to a GeoClient ID
                if (!string.IsNullOrEmpty(Silo.CurrentSilo.ClusterId))
                {
                    client = GrainId.NewClientId(client.PrimaryKey, Silo.CurrentSilo.ClusterId);
                }
            }

            gateway.RecordOpenedSocket(sock, client);
            return(true);
        }
Exemple #2
0
        protected override bool RecordOpenedSocket(Socket sock)
        {
            ThreadTrackingStatistic.FirstClientConnectedStartTracking();
            Guid client;

            if (!ReceiveSocketPreample(sock, true, out client))
            {
                return(false);
            }

            gateway.RecordOpenedSocket(sock, client);
            return(true);
        }