示例#1
0
        public override bool Equals(object obj)
        {
            SetWatches objA = (SetWatches)obj;

            if (objA == null)
            {
                return(false);
            }
            if (object.ReferenceEquals(objA, this))
            {
                return(true);
            }
            bool flag = false;

            flag = this.RelativeZxid == objA.RelativeZxid;
            if (flag)
            {
                flag = this.DataWatches.Equals(objA.DataWatches);
                if (!flag)
                {
                    return(flag);
                }
                flag = this.ExistWatches.Equals(objA.ExistWatches);
                if (!flag)
                {
                    return(flag);
                }
                flag = this.ChildWatches.Equals(objA.ChildWatches);
                if (!flag)
                {
                    return(flag);
                }
            }
            return(flag);
        }
示例#2
0
 public override bool Equals(object obj)
 {
     SetWatches peer = (SetWatches)obj;
     if (peer == null)
     {
         return false;
     }
     if (Object.ReferenceEquals(peer, this))
     {
         return true;
     }
     bool ret = false;
     ret = (RelativeZxid == peer.RelativeZxid);
     if (!ret) return ret;
     ret = DataWatches.Equals(peer.DataWatches);
     if (!ret) return ret;
     ret = ExistWatches.Equals(peer.ExistWatches);
     if (!ret) return ret;
     ret = ChildWatches.Equals(peer.ChildWatches);
     if (!ret) return ret;
     return ret;
 }
示例#3
0
        public override bool Equals(object obj)
        {
            SetWatches setWatches = (SetWatches)obj;

            if (setWatches == null)
            {
                return(false);
            }
            if (object.ReferenceEquals((object)setWatches, (object)this))
            {
                return(true);
            }
            bool flag1 = this.RelativeZxid == setWatches.RelativeZxid;

            if (!flag1)
            {
                return(flag1);
            }
            bool flag2 = this.DataWatches.Equals((object)setWatches.DataWatches);

            if (!flag2)
            {
                return(flag2);
            }
            bool flag3 = this.ExistWatches.Equals((object)setWatches.ExistWatches);

            if (!flag3)
            {
                return(flag3);
            }
            bool flag4 = this.ChildWatches.Equals((object)setWatches.ChildWatches);

            if (!flag4)
            {
                return(flag4);
            }
            return(flag4);
        }
        private void PrimeConnection(TcpClient client)
        {
            LOG.Info(string.Format("Socket connection established to {0}, initiating session", client.Client.RemoteEndPoint));

            ConnectRequest conReq = new ConnectRequest(0, lastZxid, Convert.ToInt32(conn.SessionTimeout.TotalMilliseconds), conn.SessionId, conn.SessionPassword);

            byte[] buffer;
            using (MemoryStream ms = new MemoryStream())
            using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, ms, Encoding.UTF8))
            {
                BinaryOutputArchive boa = BinaryOutputArchive.getArchive(writer);
                boa.WriteInt(-1, "len");
                conReq.Serialize(boa, "connect");
                ms.Position = 0;
                writer.Write(ms.ToArray().Length - 4);
                buffer = ms.ToArray();
            }
            lock (outgoingQueueLock)
            {
                if (!ClientConnection.disableAutoWatchReset && (!zooKeeper.DataWatches.IsEmpty() || !zooKeeper.ExistWatches.IsEmpty() || !zooKeeper.ChildWatches.IsEmpty()))
                {
                    var sw = new SetWatches(lastZxid, zooKeeper.DataWatches, zooKeeper.ExistWatches, zooKeeper.ChildWatches);
                    var h = new RequestHeader();
                    h.Type = (int)OpCode.SetWatches;
                    h.Xid = -8;
                    Packet packet = new Packet(h, new ReplyHeader(), sw, null, null, null, null, null);
                    outgoingQueue.AddFirst(packet);
                }

                foreach (ClientConnection.AuthData id in conn.authInfo)
                {
                    outgoingQueue.AddFirst(new Packet(new RequestHeader(-4, (int)OpCode.Auth), null, new AuthPacket(0, id.scheme, id.data), null, null, null, null, null));
                }
                outgoingQueue.AddFirst((new Packet(null, null, null, null, buffer, null, null, null)));
            }

            lock (this)
            {
                EnableWrite();
            }

            if (LOG.IsDebugEnabled)
            {
                LOG.Debug("Session establishment request sent on " + client.Client.RemoteEndPoint);
            }
        }
        private void PrimeConnection()
        {
            LOG.InfoFormat("Socket connection established to {0}, initiating session", client.Client.RemoteEndPoint);
            ConnectRequest conReq = new ConnectRequest(0, lastZxid, Convert.ToInt32(conn.SessionTimeout.TotalMilliseconds), conn.SessionId, conn.SessionPassword);

            lock (outgoingQueue)
            {
                if (!ClientConnection.DisableAutoWatchReset && (!zooKeeper.DataWatches.IsEmpty() || !zooKeeper.ExistWatches.IsEmpty() || !zooKeeper.ChildWatches.IsEmpty()))
                {
                    var sw = new SetWatches(lastZxid, zooKeeper.DataWatches, zooKeeper.ExistWatches, zooKeeper.ChildWatches);
                    var h = new RequestHeader();
                    h.Type = (int)OpCode.SetWatches;
                    h.Xid = -8;
                    Packet packet = new Packet(h, new ReplyHeader(), sw, null, null, null, null, null);
                    //outgoingQueue.AddFirst(packet);
                    addPacketFirst(packet);
                }

                foreach (ClientConnection.AuthData id in conn.authInfo)
                    addPacketFirst(
                        new Packet(new RequestHeader(-4, (int) OpCode.Auth), null, new AuthPacket(0, id.Scheme, id.GetData()), null, null, null, null, null));

                addPacketFirst(new Packet(null, null, conReq, null, null, null, null, null));
                
            }
            packetAre.Set();
            if (LOG.IsDebugEnabled)
                LOG.DebugFormat("Session establishment request sent on {0}",client.Client.RemoteEndPoint);
        }