Example #1
0
 /// <summary>
 /// close conn
 /// </summary>
 public void CloseConnection()
 {
     if (this.Connected)
     {
         // 断开连接
         try
         {
             var header = new FDFSHeader(0, Consts.FDFS_PROTO_CMD_QUIT, 0);
             var buffer = header.ToByte();
             this.GetStream().Write(buffer, 0, buffer.Length);
             this.GetStream().Close();
         }
         catch
         {
         }
         // 关闭连接
         try
         {
             this.Close();
         }
         catch
         {
         }
     }
 }
Example #2
0
        public void ReleaseConnection(Connection conn)
        {
            if (!conn.InUse)
            {
                var header = new FDFSHeader(0, Consts.FDFS_PROTO_CMD_QUIT, 0);
                var buffer = header.ToByte();
                conn.GetStream().Write(buffer, 0, buffer.Length);
                conn.GetStream().Close();
            }

            conn.Close();

            lock ((_inUse as ICollection).SyncRoot)
            {
                _inUse.Remove(conn);
            }
            _autoEvent.Set();
        }
Example #3
0
        public void ReleaseConnection(Connection conn)
        {
            if (!conn.InUse)
            {
                var header = new FDFSHeader(0, Consts.FDFS_PROTO_CMD_QUIT, 0);
                var buffer = header.ToByte();
                conn.GetStream().Write(buffer, 0, buffer.Length);
                conn.GetStream().Close();
            }

            conn.Close();

            lock ((_inUse as ICollection).SyncRoot)
            {
                _inUse.Remove(conn);
            }
            _autoEvent.Set();
        }