Commit 1589fdbd authored by Marco De Marco's avatar Marco De Marco
Browse files

Protocol class modified

parent 072a3d72
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,5 +19,5 @@ message Response
	optional string file_path = 3;
	optional int32 file_version = 4;
	optional string file_name = 5;
	optional uint64 size = 6;
	optional uint64 file_size = 6;
}
+4 −4
Original line number Diff line number Diff line
@@ -61,17 +61,17 @@ bool FileWrapper::isBad()
//==============================================================================
bool FileWrapper::isCompleted()
{
    return m_inputFileStream.tellg() >= m_inputFileSize;
    return (boost::uint64_t)m_inputFileStream.tellg() >= m_inputFileSize;
}

//==============================================================================
//      FileWrapper::read()
//==============================================================================
void FileWrapper::read(std::vector<char>& writeBuff) throw(std::runtime_error)
void FileWrapper::read(std::vector<char>& writeBuff)
{
    int leftToRead = m_inputFileSize - m_inputFileStream.tellg();
    boost::uint64_t leftToRead = m_inputFileSize - m_inputFileStream.tellg();

    int bufferSize = 0;
    boost::uint64_t bufferSize = 0;

    if(leftToRead < BUFFER_SIZE)
            bufferSize = leftToRead;
+3 −3
Original line number Diff line number Diff line
@@ -49,20 +49,20 @@ public:

    virtual bool isCompleted();

    virtual void read(std::vector<char>&) throw(std::runtime_error);
    virtual void read(std::vector<char>&);

protected:
//------------------------------------------------------------------------------
//  [Protected] Class variables
//------------------------------------------------------------------------------
    //Input file size
    int m_inputFileSize;
    boost::uint64_t m_inputFileSize;

    //Input file stream
    std::ifstream m_inputFileStream;

    //Read buffer size
    const int BUFFER_SIZE = 1024;
    const boost::uint64_t BUFFER_SIZE = 40960;
};

}   //End of namespace
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ ResponseSP ProtocolManager::prepareResponse(RequestSP request_sp)
                        response_sp->set_file_path(filePath);
                        response_sp->set_file_version(fileVersion);
                        response_sp->set_file_name(fileName);
                        response_sp->set_size(fileSize);
                        response_sp->set_file_size(fileSize);
                    }
                    else
                    {
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public:

protected:
//------------------------------------------------------------------------------
//  [Protected]
//  [Protected] File path method
//------------------------------------------------------------------------------
    virtual boost::filesystem::path composePath(std::string, std::string,
        int, std::string);
Loading