Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
193cd31c
Commit
193cd31c
authored
May 29, 2017
by
Marcin Siodelski
Browse files
[5189] Miscellanous corrections.
parent
80b2f09c
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/bin/agent/ca_command_mgr.cc
View file @
193cd31c
...
...
@@ -30,6 +30,7 @@ using namespace isc::process;
namespace
{
/// @brief Client side connection timeout.
/// @todo Make it configurable.
const
long
CONNECTION_TIMEOUT
=
5000
;
}
...
...
@@ -206,7 +207,8 @@ CtrlAgentCommandMgr::forwardCommand(const std::string& service,
// Capture error code and parsed data.
received_ec
=
ec
;
received_feed
=
feed
;
// Stop the IO service so as we can continue.
// Got the IO service so stop IO service. This causes to
// stop IO service when all handlers have been invoked.
io_service
->
stopWork
();
},
ClientConnection
::
Timeout
(
CONNECTION_TIMEOUT
));
io_service
->
run
();
...
...
src/bin/agent/ca_command_mgr.h
View file @
193cd31c
...
...
@@ -11,7 +11,6 @@
#include
<exceptions/exceptions.h>
#include
<boost/noncopyable.hpp>
#include
<boost/shared_ptr.hpp>
#include
<array>
namespace
isc
{
namespace
agent
{
...
...
src/bin/agent/tests/ca_command_mgr_unittests.cc
View file @
193cd31c
...
...
@@ -229,9 +229,9 @@ public:
bindServerSocket
(
server_response
,
true
);
// The client side communication is synchronous. To be able to respond
// to this we need to run the server side socket at the same time
.
// Running IO service in a thread guarantees that the server
responds
// as soon as it receives the control command.
// to this we need to run the server side socket at the same time
as the
//
client.
Running IO service in a thread guarantees that the server
//
responds
as soon as it receives the control command.
isc
::
util
::
thread
::
Thread
th
(
boost
::
bind
(
&
IOService
::
run
,
getIOService
().
get
()));
...
...
@@ -243,13 +243,15 @@ public:
ConstElementPtr
answer
=
mgr_
.
handleCommand
(
"foo"
,
ConstElementPtr
(),
command
);
// Cancel all asynchronous operations and let the handlers to be invoked
// with operation_aborted error code.
server_socket_
->
stopServer
();
getIOService
()
->
stopWork
();
// Wait for the thread to finish.
th
.
wait
();
EXPECT_EQ
(
expected_responses
,
server_socket_
->
getResponseNum
());
checkAnswer
(
answer
,
expected_result0
,
expected_result1
,
expected_result2
);
}
...
...
@@ -367,9 +369,12 @@ TEST_F(CtrlAgentCommandMgrTest, forwardListCommands) {
ConstElementPtr
answer
=
mgr_
.
handleCommand
(
"list-commands"
,
ConstElementPtr
(),
command
);
// Cancel all asynchronous operations and let the handlers to be invoked
// with operation_aborted error code.
server_socket_
->
stopServer
();
getIOService
()
->
stopWork
();
// Wait for the thread to finish.
th
.
wait
();
// Answer of 3 is specific to the stub response we send when the
...
...
src/lib/asiolink/tests/unix_domain_socket_unittest.cc
View file @
193cd31c
...
...
@@ -132,7 +132,7 @@ TEST_F(UnixDomainSocketTest, asyncSendReceive) {
connect_handler_invoked
=
true
;
// Operation aborted indicates that IO service has been stopped. This
// shouldn't happen here.
if
(
ec
&&
ec
.
value
()
!=
boost
::
asio
::
error
::
operation_aborted
)
{
if
(
ec
&&
(
ec
.
value
()
!=
boost
::
asio
::
error
::
operation_aborted
)
)
{
ADD_FAILURE
()
<<
"error occurred while asynchronously connecting"
" via unix domain socket: "
<<
ec
.
message
();
}
...
...
src/lib/asiolink/testutils/test_server_unix_socket.cc
View file @
193cd31c
...
...
@@ -257,6 +257,9 @@ TestServerUnixSocket::bindServerSocket(const bool use_thread) {
server_acceptor_
.
listen
();
accept
();
// When threads are in use, we need to post a handler which will be invoked
// when the thread has already started and the IO service is running. The
// main thread can move forward when it receives this signal from the handler.
if
(
use_thread
)
{
io_service_
.
post
(
boost
::
bind
(
&
TestServerUnixSocket
::
signalRunning
,
this
));
...
...
src/lib/asiolink/unix_domain_socket.cc
View file @
193cd31c
...
...
@@ -105,7 +105,7 @@ public:
/// @brief Asynchronously receive data over the socket.
///
/// This method schedules asynchronous receive and installs the
/// @ref UnixDomainSocket::receiveHandler is a callback.
/// @ref UnixDomainSocket
Impl
::receiveHandler is a callback.
///
/// @param data Pointer to a buffer into which the data should be read.
/// @param length Length of the buffer.
...
...
src/lib/asiolink/unix_domain_socket.h
View file @
193cd31c
...
...
@@ -80,7 +80,7 @@ public:
///
/// @param data Pointer to data to be sent.
/// @param length Number of bytes to be sent.
/// @param handler Callback to be invoked when data have been sent or
an
/// @param handler Callback to be invoked when data have been sent or
/// sending error is signalled.
void
asyncSend
(
const
void
*
data
,
const
size_t
length
,
const
Handler
&
handler
);
...
...
src/lib/config/tests/client_connection_unittests.cc
View file @
193cd31c
...
...
@@ -26,6 +26,7 @@ const std::string TEST_SOCKET = "test-socket";
/// @brief Test timeout in ms.
const
long
TEST_TIMEOUT
=
10000
;
// Test fixture class for @ref ClientConnection.
class
ClientConnectionTest
:
public
::
testing
::
Test
{
public:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment