////////////////////////////// 6. ChunkPing Protocol ////////////////////////// bool ProtocolChunkPing::encode_body(ByteBuffer *byte_buffer) { ////chunk id ENCODE_STRING(m_chunk_info.id); ////chunk ip ENCODE_STRING(m_chunk_info.ip); ////chunk port ENCODE_INT(m_chunk_info.port); //// disk space ENCODE_INT64(m_chunk_info.disk_space); ////disk used ENCODE_INT64(m_chunk_info.disk_used); return true; }
//////////////// 回复文件大小 //////////////////// //编码协议体数据到byte_buffer,成功返回true,失败返回false. bool RespondSize::encode_body(ByteBuffer *byte_buffer) { int len = 0; //file size ENCODE_INT64(m_file_size); //file name ENCODE_STRING(m_file_name); return true; }
////////////////////// 回复数据 ///////////////////// //编码协议体数据到io_buffer.成功返回编码后协议体长度(大于0),失败返回-1; bool RespondData::encode_body(ByteBuffer *byte_buffer) { int len = 0; //file name ENCODE_STRING(m_file_name); //start pos ENCODE_INT64(m_start_pos); //size ENCODE_INT(m_size); return true; }