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.
/// 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
/// @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,
}
} 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();
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.