示例#1
0
 public virtual void setSocket(Socket sock)
 {
     lock (this._lockContext)
     {
         this._sock       = sock;
         this._dsContext  = null;
         this._sqlContext = null;
         if (this._datasetRequestQueue != null)
         {
             this._datasetRequestQueue.Clear();
         }
         this._curDispatchAttrib = null;
     }
 }
示例#2
0
 public void setConnected(Socket sock)
 {
     this._sock             = sock;
     this._loginState       = 0;
     this.RemoteEndPoint    = (sock.RemoteEndPoint as IPEndPoint);
     this._requestSN        = 0uL;
     this._dsContext        = new ConnectContext.SerializeContext();
     this._sqlContext       = new ConnectContext.SerializeContext();
     this._vid              = -1L;
     this._lastRequesdtType = -1;
     if (this._curDispatchAttrib != null)
     {
         this._curDispatchAttrib.dispatchPointer = -1;
     }
 }
示例#3
0
 public ConnectContext(Socket sock)
 {
     this._sock                = sock;
     this._loginState          = 0;
     this.RemoteEndPoint       = (sock.RemoteEndPoint as IPEndPoint);
     this._requestSN           = 0uL;
     this._dsContext           = new ConnectContext.SerializeContext();
     this._sqlContext          = new ConnectContext.SerializeContext();
     this._datasetRequestQueue = new Queue <DispatchAttribute>();
     this._curDispatchAttrib   = null;
     this._vid              = -1L;
     this._bKicked          = false;
     this._bServiceWillDown = false;
     this._lastRequesdtType = -1;
     this._sslPendingQ      = new ConcurrentQueue <BufferState>();
     this._sslSending       = false;
 }
示例#4
0
 private void ReceiveDataset(ref ConnectContext.SerializeContext context, byte[] packet)
 {
     try
     {
         int num = 0;
         this._headBytes = BitConverter.GetBytes(ecoServerProtocol.swap64(this._header));
         int uid = (int)ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(this._receiveBuffer, num));
         num += 2;
         int vid = (int)ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(this._receiveBuffer, num));
         num += 2;
         int type = (int)ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(this._receiveBuffer, num));
         num += 2;
         int num2 = (int)packet[num];
         num++;
         int num4;
         if ((num2 & 1) != 0)
         {
             DateTime arg_77_0 = DateTime.Now;
             Common.WriteLine("Dataset from server: type={0}, uid={1}, vid={2}", new string[]
             {
                 type.ToString("X8"),
                 uid.ToString(),
                 vid.ToString()
             });
             ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(packet, num));
             num += 2;
             uint num3 = ecoServerProtocol.swap32((uint)BitConverter.ToInt32(packet, num));
             num += 4;
             num4 = (int)ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(packet, num));
             num += 2;
             uint num5 = ecoServerProtocol.swap32((uint)BitConverter.ToInt32(packet, num));
             num += 4;
             context._compress = (int)(num5 & 15u);
             num4 -= 4;
             context._hashDataSet = new byte[num4];
             Array.Copy(packet, num, context._hashDataSet, 0, num4);
             num4 = 0;
             context._dataSize     = 0;
             context._dataBuffer   = new byte[num3];
             context._tPacketStart = (long)Environment.TickCount;
             Common.WriteLine("    DataSet begin, uid={0}, vid={1}, type={2}, total={3}, Elapsed=0", new string[]
             {
                 uid.ToString(),
                 vid.ToString(),
                 type.ToString("X8"),
                 num3.ToString()
             });
         }
         else
         {
             ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(packet, num));
             num += 2;
             num4 = (int)ecoServerProtocol.swap16((ushort)BitConverter.ToInt16(packet, num));
             num += 2;
         }
         if (context._dataBuffer != null && packet != null && num4 > 0)
         {
             Array.Copy(packet, num, context._dataBuffer, context._dataSize, num4);
             context._dataSize += num4;
         }
         if ((num2 & 2) != 0)
         {
             if (context._dataBuffer != null)
             {
                 long   num6  = Common.ElapsedTime(context._tPacketStart);
                 bool   flag  = false;
                 MD5    mD    = MD5.Create();
                 byte[] first = mD.ComputeHash(context._dataBuffer, 0, context._dataBuffer.Length);
                 if (context._hashDataSet != null && !first.SequenceEqual(context._hashDataSet))
                 {
                     flag = true;
                 }
                 DateTime arg_255_0 = DateTime.Now;
                 if (flag)
                 {
                     Common.WriteLine("    DataSet crashed: uid={0}, vid={1}, type={2}, size={3}, elapsed: {4}", new string[]
                     {
                         uid.ToString(),
                         vid.ToString(),
                         type.ToString("X8"),
                         context._dataBuffer.Length.ToString(),
                         num6.ToString()
                     });
                 }
                 else
                 {
                     Common.WriteLine("    DataSet end: uid={0}, vid={1}, type={2}, size={3}, elapsed: {4}", new string[]
                     {
                         uid.ToString(),
                         vid.ToString(),
                         type.ToString("X8"),
                         context._dataBuffer.Length.ToString(),
                         num6.ToString()
                     });
                 }
                 DispatchAttribute dispatchAttribute = new DispatchAttribute();
                 dispatchAttribute.uid       = uid;
                 dispatchAttribute.vid       = vid;
                 dispatchAttribute.type      = type;
                 dispatchAttribute.algorithm = context._compress;
                 dispatchAttribute.data      = context._dataBuffer;
                 dispatchAttribute.owner     = this._owner;
                 Serialization serialization = new Serialization();
                 serialization.StartDecompressThread(dispatchAttribute);
             }
             context._dataSize   = 0;
             context._dataBuffer = null;
         }
     }
     catch (Exception ex)
     {
         Common.WriteLine(ex.Message, new string[0]);
     }
 }