Skip to content

Commit 1b070fe

Browse files
author
Razvan Becheriu
committed
[#3190] use smart pointer to capture IOService instance
1 parent 8c1f22e commit 1b070fe

File tree

108 files changed

+785
-757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+785
-757
lines changed

src/bin/agent/ca_command_mgr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ CtrlAgentCommandMgr::forwardCommand(const std::string& service,
226226

227227
// Forward command and receive reply.
228228
IOServicePtr io_service(new IOService());;
229-
ClientConnection conn(*io_service);
229+
ClientConnection conn(io_service);
230230
boost::system::error_code received_ec;
231231
ConstJSONFeedPtr received_feed;
232232
conn.start(ClientConnection::SocketPath(socket_name),

src/bin/agent/ca_process.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
164164
// Create http listener. It will open up a TCP socket and be
165165
// prepared to accept incoming connection.
166166
HttpListenerPtr http_listener
167-
(new HttpListener(*getIOService(), server_address,
167+
(new HttpListener(getIOService(), server_address,
168168
server_port, tls_context, rcf,
169169
HttpListener::RequestTimeout(TIMEOUT_AGENT_RECEIVE_COMMAND),
170170
HttpListener::IdleTimeout(TIMEOUT_AGENT_IDLE_CONNECTION_TIMEOUT)));

src/bin/agent/tests/ca_command_mgr_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class CtrlAgentCommandMgrTest : public DControllerTest {
170170
/// @param use_thread Indicates if the IO service will be ran in thread.
171171
void bindServerSocket(const std::string& response,
172172
const bool use_thread = false) {
173-
server_socket_.reset(new test::TestServerUnixSocket(*getIOService(),
173+
server_socket_.reset(new test::TestServerUnixSocket(getIOService(),
174174
unixSocketFilePath(),
175175
response));
176176
server_socket_->startTimer(TEST_TIMEOUT);

src/bin/agent/tests/ca_controller_unittests.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ TEST_F(CtrlAgentControllerTest, launchNormalShutdown) {
242242
// Tests that the SIGINT triggers a normal shutdown.
243243
TEST_F(CtrlAgentControllerTest, sigintShutdown) {
244244
// Setup to raise SIGHUP in 1 ms.
245-
TimedSignal sighup(*getIOService(), SIGINT, 1);
245+
TimedSignal sighup(getIOService(), SIGINT, 1);
246246

247247
// Write valid_agent_config and then run launch() for a maximum
248248
// of 1000 ms.
@@ -258,7 +258,7 @@ TEST_F(CtrlAgentControllerTest, sigintShutdown) {
258258
// Tests that the SIGTERM triggers a normal shutdown.
259259
TEST_F(CtrlAgentControllerTest, sigtermShutdown) {
260260
// Setup to raise SIGTERM in 1 ms.
261-
TimedSignal sighup(*getIOService(), SIGTERM, 1);
261+
TimedSignal sighup(getIOService(), SIGTERM, 1);
262262

263263
// Write valid_agent_config and then run launch() for a maximum of 1 s.
264264
time_duration elapsed_time;
@@ -307,7 +307,7 @@ TEST_F(CtrlAgentControllerTest, successfulConfigUpdate) {
307307
// Schedule reconfiguration.
308308
scheduleTimedWrite(second_config, 100);
309309
// Schedule SIGHUP signal to trigger reconfiguration.
310-
TimedSignal sighup(*getIOService(), SIGHUP, 200);
310+
TimedSignal sighup(getIOService(), SIGHUP, 200);
311311

312312
// Start the server.
313313
time_duration elapsed_time;
@@ -372,7 +372,7 @@ TEST_F(CtrlAgentControllerTest, unsuccessfulConfigUpdate) {
372372
// Schedule reconfiguration.
373373
scheduleTimedWrite(second_config, 100);
374374
// Schedule SIGHUP signal to trigger reconfiguration.
375-
TimedSignal sighup(*getIOService(), SIGHUP, 200);
375+
TimedSignal sighup(getIOService(), SIGHUP, 200);
376376

377377
// Start the server.
378378
time_duration elapsed_time;
@@ -438,7 +438,7 @@ TEST_F(CtrlAgentControllerTest, noListenerChange) {
438438
// Schedule reconfiguration.
439439
scheduleTimedWrite(second_config, 100);
440440
// Schedule SIGHUP signal to trigger reconfiguration.
441-
TimedSignal sighup(*getIOService(), SIGHUP, 200);
441+
TimedSignal sighup(getIOService(), SIGHUP, 200);
442442

443443
// Start the server.
444444
time_duration elapsed_time;

src/bin/agent/tests/ca_process_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TEST(CtrlAgentProcess, construction) {
6767
TEST_F(CtrlAgentProcessTest, shutdown) {
6868
// Use an asiolink IntervalTimer and callback to generate the
6969
// shutdown invocation. (Note IntervalTimer setup is in milliseconds).
70-
IntervalTimer timer(*getIOService());
70+
IntervalTimer timer(getIOService());
7171
timer.setup(std::bind(&CtrlAgentProcessTest::genShutdownCallback, this),
7272
200);
7373

src/bin/d2/d2_queue_mgr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ D2QueueMgr::startListening() {
131131

132132
// Instruct the listener to start listening and set state accordingly.
133133
try {
134-
listener_->startListening(*io_service_);
134+
listener_->startListening(io_service_);
135135
mgr_state_ = RUNNING;
136136
} catch (const isc::Exception& ex) {
137137
isc_throw(D2QueueMgrError, "D2QueueMgr listener start failed: "

src/bin/d2/tests/d2_controller_unittests.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ TEST_F(D2ControllerTest, invalidConfigReload) {
207207
scheduleTimedWrite("{ \"string_test\": BOGUS JSON }", 100);
208208

209209
// Setup to raise SIGHUP in 200 ms.
210-
TimedSignal sighup(*getIOService(), SIGHUP, 200);
210+
TimedSignal sighup(getIOService(), SIGHUP, 200);
211211

212212
// Write valid_d2_config and then run launch() for a maximum of 500 ms.
213213
time_duration elapsed_time;
@@ -246,7 +246,7 @@ TEST_F(D2ControllerTest, validConfigReload) {
246246
scheduleTimedWrite(second_cfg, 100);
247247

248248
// Setup to raise SIGHUP in 200 ms.
249-
TimedSignal sighup(*getIOService(), SIGHUP, 200);
249+
TimedSignal sighup(getIOService(), SIGHUP, 200);
250250

251251
// Write valid_d2_config and then run launch() for a maximum of 500ms.
252252
time_duration elapsed_time;
@@ -269,7 +269,7 @@ TEST_F(D2ControllerTest, validConfigReload) {
269269
// Tests that the SIGINT triggers a normal shutdown.
270270
TEST_F(D2ControllerTest, sigintShutdown) {
271271
// Setup to raise SIGINT in 1 ms.
272-
TimedSignal sighup(*getIOService(), SIGINT, 1);
272+
TimedSignal sighup(getIOService(), SIGINT, 1);
273273

274274
// Write valid_d2_config and then run launch() for a maximum of 1000 ms.
275275
time_duration elapsed_time;
@@ -286,7 +286,7 @@ TEST_F(D2ControllerTest, sigintShutdown) {
286286
// Tests that the SIGTERM triggers a normal shutdown.
287287
TEST_F(D2ControllerTest, sigtermShutdown) {
288288
// Setup to raise SIGTERM in 1 ms.
289-
TimedSignal sighup(*getIOService(), SIGTERM, 1);
289+
TimedSignal sighup(getIOService(), SIGTERM, 1);
290290

291291
// Write valid_d2_config and then run launch() for a maximum of 1 s.
292292
time_duration elapsed_time;

src/bin/d2/tests/d2_process_unittests.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ TEST_F(D2ProcessTest, canShutdown) {
561561
TEST_F(D2ProcessTest, normalShutdown) {
562562
// Use an asiolink IntervalTimer and callback to generate the
563563
// shutdown invocation. (Note IntervalTimer setup is in milliseconds).
564-
isc::asiolink::IntervalTimer timer(*getIOService());
564+
isc::asiolink::IntervalTimer timer(getIOService());
565565
timer.setup(std::bind(&D2ProcessTest::genShutdownCallback, this),
566566
2 * 1000);
567567

@@ -585,7 +585,7 @@ TEST_F(D2ProcessTest, normalShutdown) {
585585
TEST_F(D2ProcessTest, fatalErrorShutdown) {
586586
// Use an asiolink IntervalTimer and callback to generate the
587587
// the exception. (Note IntervalTimer setup is in milliseconds).
588-
isc::asiolink::IntervalTimer timer(*getIOService());
588+
isc::asiolink::IntervalTimer timer(getIOService());
589589
timer.setup(std::bind(&D2ProcessTest::genFatalErrorCallback, this),
590590
2 * 1000);
591591

src/bin/d2/tests/d2_queue_mgr_unittests.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class QueueMgrUDPTest : public virtual ::testing::Test, public D2StatTest,
209209
NameChangeSender::RequestSendHandler {
210210
public:
211211
asiolink::IOServicePtr io_service_;
212-
NameChangeSenderPtr sender_;
212+
NameChangeSenderPtr sender_;
213213
isc::asiolink::IntervalTimer test_timer_;
214214
D2QueueMgrPtr queue_mgr_;
215215

@@ -218,7 +218,7 @@ class QueueMgrUDPTest : public virtual ::testing::Test, public D2StatTest,
218218
std::vector<NameChangeRequestPtr> received_ncrs_;
219219

220220
QueueMgrUDPTest() : io_service_(new isc::asiolink::IOService()),
221-
test_timer_(*io_service_),
221+
test_timer_(io_service_),
222222
send_result_(NameChangeSender::SUCCESS) {
223223
isc::asiolink::IOAddress addr(TEST_ADDRESS);
224224
// Create our sender instance. Note that reuse_address is true.
@@ -359,7 +359,7 @@ TEST_F (QueueMgrUDPTest, liveFeed) {
359359
ASSERT_EQ(D2QueueMgr::RUNNING, queue_mgr_->getMgrState());
360360

361361
// Place the sender into sending state.
362-
ASSERT_NO_THROW(sender_->startSending(*io_service_));
362+
ASSERT_NO_THROW(sender_->startSending(io_service_));
363363
ASSERT_TRUE(sender_->amSending());
364364

365365
// Iterate over the list of requests sending and receiving

src/bin/d2/tests/d2_update_mgr_unittests.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ TEST_F(D2UpdateMgrTest, addTransaction) {
692692

693693
// Create a server based on the transaction's current server, and
694694
// start it listening.
695-
FauxServer server(*io_service_, *(trans->getCurrentServer()));
695+
FauxServer server(io_service_, *(trans->getCurrentServer()));
696696
server.receive(FauxServer::USE_RCODE, dns::Rcode::NOERROR());
697697

698698
// Run sweep and IO until everything is done.
@@ -747,9 +747,9 @@ TEST_F(D2UpdateMgrTest, removeTransaction) {
747747
ASSERT_EQ(1, trans->getUpdateAttempts());
748748
ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent());
749749

750-
// Create a server based on the transaction's current server,
751-
// and start it listening.
752-
FauxServer server(*io_service_, *(trans->getCurrentServer()));
750+
// Create a server based on the transaction's current server, and
751+
// start it listening.
752+
FauxServer server(io_service_, *(trans->getCurrentServer()));
753753
server.receive(FauxServer::USE_RCODE, dns::Rcode::NOERROR());
754754

755755
// Run sweep and IO until everything is done.
@@ -797,7 +797,7 @@ TEST_F(D2UpdateMgrTest, errorTransaction) {
797797
ASSERT_TRUE(trans->getCurrentServer());
798798

799799
// Create a server and start it listening.
800-
FauxServer server(*io_service_, *(trans->getCurrentServer()));
800+
FauxServer server(io_service_, *(trans->getCurrentServer()));
801801
server.receive(FauxServer::CORRUPT_RESP);
802802

803803
// Run sweep and IO until everything is done.
@@ -836,7 +836,7 @@ TEST_F(D2UpdateMgrTest, multiTransaction) {
836836
// that all of configured servers have the same address.
837837
// and start it listening.
838838
asiolink::IOAddress server_ip("127.0.0.1");
839-
FauxServer server(*io_service_, server_ip, 5301);
839+
FauxServer server(io_service_, server_ip, 5301);
840840
server.receive(FauxServer::USE_RCODE, dns::Rcode::NOERROR());
841841

842842
// Run sweep and IO until everything is done.
@@ -908,7 +908,7 @@ TEST_F(D2UpdateMgrTest, simpleAddTransaction) {
908908

909909
// Create a server based on the transaction's current server, and
910910
// start it listening.
911-
FauxServer server(*io_service_, *(trans->getCurrentServer()));
911+
FauxServer server(io_service_, *(trans->getCurrentServer()));
912912
server.receive(FauxServer::USE_RCODE, dns::Rcode::NOERROR());
913913

914914
// Run sweep and IO until everything is done.
@@ -964,9 +964,9 @@ TEST_F(D2UpdateMgrTest, simpleRemoveTransaction) {
964964
ASSERT_EQ(1, trans->getUpdateAttempts());
965965
ASSERT_EQ(StateModel::NOP_EVT, trans->getNextEvent());
966966

967-
// Create a server based on the transaction's current server,
968-
// and start it listening.
969-
FauxServer server(*io_service_, *(trans->getCurrentServer()));
967+
// Create a server based on the transaction's current server, and
968+
// start it listening.
969+
FauxServer server(io_service_, *(trans->getCurrentServer()));
970970
server.receive(FauxServer::USE_RCODE, dns::Rcode::NOERROR());
971971

972972
// Run sweep and IO until everything is done.

src/bin/dhcp4/tests/kea_controller_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class JSONFileBackendTest : public isc::dhcp::test::BaseServerTest {
229229
/// stops the IO service and causes the function to return.
230230
void runTimersWithTimeout(const IOServicePtr& io_service, const long timeout_ms,
231231
std::function<bool()> cond = std::function<bool()>()) {
232-
IntervalTimer timer(*io_service);
232+
IntervalTimer timer(io_service);
233233
std::atomic<bool> stopped(false);
234234
timer.setup([&io_service, &stopped]() {
235235
stopped = true;

src/bin/dhcp6/tests/kea_controller_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class JSONFileBackendTest : public dhcp::test::BaseServerTest {
216216
/// stops the IO service and causes the function to return.
217217
void runTimersWithTimeout(const IOServicePtr& io_service, const long timeout_ms,
218218
std::function<bool()> cond = std::function<bool()>()) {
219-
IntervalTimer timer(*io_service);
219+
IntervalTimer timer(io_service);
220220
std::atomic<bool> stopped(false);
221221
timer.setup([&io_service, &stopped]() {
222222
stopped = true;

src/bin/netconf/http_control_socket.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ HttpControlSocket::sendCommand(ConstElementPtr command) {
7979
}
8080

8181
IOServicePtr io_service(new IOService());
82-
HttpClient client(*io_service, false);
82+
HttpClient client(io_service, false);
8383
boost::system::error_code received_ec;
8484
string receive_errmsg;
8585
HttpResponseJsonPtr response(new HttpResponseJson());

0 commit comments

Comments
 (0)