예제 #1
0
        public virtual void GetResponse(FDFSResponse response)
        {
            if (this._connection == null)
            {
                this._connection = ConnectionManager.GetTrackerConnection();
            }
            _connection.Open();
            try
            {
                NetworkStream stream = this._connection.GetStream();
                this.SendRequest(stream);


                FDFSHeader header = new FDFSHeader(stream);
                if (header.Status != 0)
                {
                    throw new FDFSException(string.Format("Get Response Error,Error Code:{0}", header.Status));
                }

                if (response != null)
                {
                    response.ReceiveResponse(stream, header.Length);
                }
                _connection.Close();
            }
            catch (Exception ex)
            {
                _connection.Release();
                throw ex;//可以看Storage节点的log看
                //22    -〉下载字节数超过文件长度 invalid download file bytes: 10 > file remain bytes: 4
                //      -> 或者 pkg length is not correct
                //2     -〉没有此文件 error info: No such file or directory.
            }
        }
예제 #2
0
        public virtual void GetResponse(FDFSResponse response)
        {
            if(this._connection == null)
                this._connection = ConnectionManager.GetTrackerConnection();
            _connection.Open();
            try
            {
                NetworkStream stream = this._connection.GetStream();
                this.SendRequest(stream);
                
                
                FDFSHeader header = new FDFSHeader(stream);
                if (header.Status != 0)
                    throw new FDFSException(string.Format("Get Response Error,Error Code:{0}", header.Status));

                if (response != null)
                    response.ReceiveResponse(stream, header.Length);
                _connection.Close();
            }
            catch(Exception ex)
            {
                _connection.Release();
                throw ex;//可以看Storage节点的log看
                //22    -〉下载字节数超过文件长度 invalid download file bytes: 10 > file remain bytes: 4
                //      -> 或者 pkg length is not correct
                //2     -〉没有此文件 error info: No such file or directory.
            }            
        }