Skip to content
Snippets Groups Projects
Commit 2128faec authored by Steven Murray's avatar Steven Murray
Browse files

Improved comments

parent 0ab2d662
Branches
Tags
No related merge requests found
......@@ -151,37 +151,57 @@ void castor::tape::tapeserver::daemon::VdqmImpl::writeDriveStatusMsg(
//-----------------------------------------------------------------------------
void castor::tape::tapeserver::daemon::VdqmImpl::readCommitAck(
const int connection) throw(castor::exception::Exception) {
char buf[12]; // Magic + type + status
legacymsg::MessageHeader ackMsg;
legacymsg::MessageHeader ack;
try {
io::readBytes(connection, m_netTimeout, sizeof(buf), buf);
ack = readAck(connection);
} catch(castor::exception::Exception &ne) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to read VDQM_COMMIT ack: "
<< ne.getMessage().str();
ex.getMessage() << "Failed to read VDQM_COMMIT ack: " <<
ne.getMessage().str();
throw ex;
}
const char *bufPtr = buf;
size_t bufLen = sizeof(buf);
legacymsg::unmarshal(bufPtr, bufLen, ackMsg);
if(VDQM_MAGIC != ackMsg.magic) {
if(VDQM_MAGIC != ack.magic) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to read VDQM_COMMIT ack: Invalid magic"
": expected=0x" << std::hex << VDQM_MAGIC << " actual=" << ackMsg.magic;
": expected=0x" << std::hex << VDQM_MAGIC << " actual=" << ack.magic;
throw ex;
}
if(VDQM_COMMIT != ackMsg.reqType) {
if(VDQM_COMMIT != ack.reqType) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to read VDQM_COMMIT ack: Invalid request type"
": expected=0x" << std::hex << VDQM_COMMIT << " actual=0x" <<
ackMsg.reqType;
ack.reqType;
throw ex;
}
}
//-----------------------------------------------------------------------------
// readAck
//-----------------------------------------------------------------------------
castor::tape::legacymsg::MessageHeader
castor::tape::tapeserver::daemon::VdqmImpl::readAck(const int connection)
throw(castor::exception::Exception) {
char buf[12]; // Magic + type + len
legacymsg::MessageHeader ack;
try {
io::readBytes(connection, m_netTimeout, sizeof(buf), buf);
} catch(castor::exception::Exception &ne) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to read VDQM_COMMIT ack: "
<< ne.getMessage().str();
throw ex;
}
const char *bufPtr = buf;
size_t bufLen = sizeof(buf);
legacymsg::unmarshal(bufPtr, bufLen, ack);
return ack;
}
//-----------------------------------------------------------------------------
// readDriveStatusMsgHeader
//-----------------------------------------------------------------------------
......
......@@ -110,18 +110,54 @@ private:
const std::string &unitName, const std::string &dgn, const int status)
throw(castor::exception::Exception);
/**
* Reads a VDQM_COMMIT ack message from the specified connection.
*
* @param connection The file-descriptor of the connection.
* @return The message.
*/
void readCommitAck(const int connection)
throw(castor::exception::Exception);
/**
* Reads an ack message from the specified connection.
*
* @param connection The file-descriptor of the connection.
* @return The message.
*/
legacymsg::MessageHeader readAck(const int connection)
throw(castor::exception::Exception);
/**
* Reads drive status message from the specified connection and discards it.
*
* @param connection The file-descriptor of the connection.
*/
void readDriveStatusMsg(const int connection)
throw(castor::exception::Exception);
/**
* Reads the header of a drive status message from the specified connection.
*
* @param connection The file-descriptor of the connection.
* @return The message header.
*/
legacymsg::MessageHeader readDriveStatusMsgHeader(const int connection)
throw(castor::exception::Exception);
/**
* Reads the body of a drive status message from the specified connection.
* @param connection The file-descriptor of the connection.
* @return The message body.
*/
legacymsg::VdqmDrvRqstMsgBody readDriveStatusMsgBody(const int connection,
const uint32_t bodyLen) throw(castor::exception::Exception);
/**
* Writes a VDQM_COMMIT ack message to the specified connection.
*
* @param connection The file-descriptor of the connection.
*/
void writeCommitAck(const int connection)
throw(castor::exception::Exception);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment