Commit 0a1a2538 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰
Browse files

[5318] Minor corrections after review.

parent d912be1f
......@@ -163,9 +163,9 @@ or HTTPS connection):
The @ref isc::config::CommandMgr is implemented using boost ASIO and uses
asynchronous calls to accept new connections and receive commands from the
controlling clients. ASIO uses IO service object to run asynchronous calls.
Thus, before the server can use the @ref isc::dhcp::CommandMgr it must
Thus, before the server can use the @ref isc::config::CommandMgr it must
provide it with a common instance of the @ref isc::asiolink::IOService
object using @ref isc::dhcp::CommandMgr::setIOService. The server's
object using @ref isc::config::CommandMgr::setIOService. The server's
main loop must contain calls to @ref isc::asiolink::IOService::run or
@ref isc::asiolink::IOService::poll or their variants to invoke Command
Manager's handlers as required for processing control requests.
......
......@@ -51,6 +51,7 @@ public:
/// Manager to cause the blocking call to @c select() to return as soon as
/// a transmission over the control socket is received.
///
/// @param io_service IOService object used to handle the asio operations
/// @param socket Pointer to the object representing a socket which is used
/// for data transmission.
/// @param connection_pool Reference to the connection pool to which this
......@@ -121,8 +122,11 @@ public:
/// @brief Starts asynchronous send over the unix domain socket.
///
/// This method doesn't block. Once the send operation is completed, the
/// @c Connection::sendHandler cllback is invoked.
/// This method doesn't block. Once the send operation (that covers the whole
/// data if it's small or first BUF_SIZE bytes if its large) is completed, the
/// @c Connection::sendHandler callback is invoked. That handler will either
/// close the connection gracefully if all data has been sent, or will
/// call @ref doSend() again to send the next chunk of data.
void doSend() {
size_t chunk_size = (response_.size() < BUF_SIZE) ? response_.size() : BUF_SIZE;
socket_->asyncSend(&response_[0], chunk_size,
......@@ -323,14 +327,15 @@ Connection::sendHandler(const boost::system::error_code& ec,
}
} else {
LOG_DEBUG(command_logger, DBG_COMMAND, COMMAND_SOCKET_WRITE)
.arg(bytes_transferred).arg(socket_->getNative());
// No error. We are in a process of sending a response. Need to
// remove the chunk that we have managed to sent with the previous
// attempt.
response_.erase(0, bytes_transferred);
LOG_DEBUG(command_logger, DBG_COMMAND, COMMAND_SOCKET_WRITE)
.arg(bytes_transferred).arg(response_.size())
.arg(socket_->getNative());
// Check if there is any data left to be sent and sent it.
if (!response_.empty()) {
doSend();
......
......@@ -90,7 +90,7 @@ over command socket identified by specified file descriptor.
This error message indicates that an error was encountered while
reading from command socket.
% COMMAND_SOCKET_WRITE Sent response of %1 bytes over command socket %2
% COMMAND_SOCKET_WRITE Sent response of %1 bytes (%2 bytes left to send) over command socket %3
This debug message indicates that the specified number of bytes was sent
over command socket identifier by the specified file descriptor.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment