diff options
Diffstat (limited to 'src/lib/dhcp_ddns')
-rw-r--r-- | src/lib/dhcp_ddns/ncr_io.cc | 14 | ||||
-rw-r--r-- | src/lib/dhcp_ddns/ncr_io.h | 30 | ||||
-rw-r--r-- | src/lib/dhcp_ddns/ncr_udp.cc | 17 | ||||
-rw-r--r-- | src/lib/dhcp_ddns/ncr_udp.h | 13 | ||||
-rw-r--r-- | src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc | 113 |
5 files changed, 98 insertions, 89 deletions
diff --git a/src/lib/dhcp_ddns/ncr_io.cc b/src/lib/dhcp_ddns/ncr_io.cc index 8e9e9cf115..1179c74adb 100644 --- a/src/lib/dhcp_ddns/ncr_io.cc +++ b/src/lib/dhcp_ddns/ncr_io.cc @@ -58,7 +58,7 @@ NameChangeListener::NameChangeListener(RequestReceiveHandler& void -NameChangeListener::startListening(isc::asiolink::IOService& io_service) { +NameChangeListener::startListening(const isc::asiolink::IOServicePtr& io_service) { if (amListening()) { // This amounts to a programmatic error. isc_throw(NcrListenerError, "NameChangeListener is already listening"); @@ -160,14 +160,14 @@ NameChangeListener::invokeRecvHandler(const Result result, NameChangeSender::NameChangeSender(RequestSendHandler& send_handler, size_t send_queue_max) : sending_(false), send_handler_(send_handler), - send_queue_max_(send_queue_max), io_service_(NULL), mutex_(new mutex) { + send_queue_max_(send_queue_max), mutex_(new mutex) { // Queue size must be big enough to hold at least 1 entry. setQueueMaxSize(send_queue_max); } void -NameChangeSender::startSending(isc::asiolink::IOService& io_service) { +NameChangeSender::startSending(const isc::asiolink::IOServicePtr& io_service) { if (amSending()) { // This amounts to a programmatic error. isc_throw(NcrSenderError, "NameChangeSender is already sending"); @@ -188,12 +188,12 @@ NameChangeSender::startSending(isc::asiolink::IOService& io_service) { } void -NameChangeSender::startSendingInternal(isc::asiolink::IOService& io_service) { +NameChangeSender::startSendingInternal(const isc::asiolink::IOServicePtr& io_service) { // Clear send marker. ncr_to_send_.reset(); // Remember io service we're given. - io_service_ = &io_service; + io_service_ = io_service; open(io_service); // Set our status to sending. @@ -211,7 +211,7 @@ NameChangeSender::stopSending() { setSending(false); // If there is an outstanding IO to complete, attempt to process it. - if (ioReady() && io_service_ != NULL) { + if (ioReady() && io_service_) { try { runReadyIO(); } catch (const std::exception& ex) { @@ -232,7 +232,7 @@ NameChangeSender::stopSending() { DHCP_DDNS_NCR_SEND_CLOSE_ERROR).arg(ex.what()); } - io_service_ = NULL; + io_service_.reset(); } void diff --git a/src/lib/dhcp_ddns/ncr_io.h b/src/lib/dhcp_ddns/ncr_io.h index 664057d961..54633df625 100644 --- a/src/lib/dhcp_ddns/ncr_io.h +++ b/src/lib/dhcp_ddns/ncr_io.h @@ -110,7 +110,6 @@ public: isc::Exception(file, line, what) { }; }; - /// @brief Abstract interface for receiving NameChangeRequests. /// /// NameChangeListener provides the means to: @@ -222,7 +221,7 @@ public: /// /// @throw NcrListenError if the listener is already "listening" or /// in the event the open or doReceive methods fail. - void startListening(isc::asiolink::IOService& io_service); + void startListening(const isc::asiolink::IOServicePtr& io_service); /// @brief Closes the IO source and stops listen logic. /// @@ -231,6 +230,7 @@ public: void stopListening(); protected: + /// @brief Initiates an asynchronous receive /// /// Sets context information to indicate that IO is in progress and invokes @@ -278,7 +278,7 @@ protected: /// /// @throw If the implementation encounters an error it MUST /// throw it as an isc::Exception or derivative. - virtual void open(isc::asiolink::IOService& io_service) = 0; + virtual void open(const isc::asiolink::IOServicePtr& io_service) = 0; /// @brief Abstract method which closes the IO source. /// @@ -352,7 +352,6 @@ private: /// @brief Defines a smart pointer to an instance of a listener. typedef boost::shared_ptr<NameChangeListener> NameChangeListenerPtr; - /// @brief Thrown when a NameChangeSender encounters an error. class NcrSenderError : public isc::Exception { public: @@ -381,7 +380,6 @@ public: isc::Exception(file, line, what) { }; }; - /// @brief Abstract interface for sending NameChangeRequests. /// /// NameChangeSender provides the means to: @@ -529,7 +527,7 @@ public: /// /// @throw NcrSenderError if the sender is already "sending" or /// NcrSenderOpenError if the open fails. - void startSending(isc::asiolink::IOService & io_service); + void startSending(const isc::asiolink::IOServicePtr& io_service); /// @brief Closes the IO sink and stops send logic. /// @@ -588,7 +586,7 @@ private: /// @brief Prepares the IO for transmission in a thread safe context. /// /// @param io_service is the IOService that will handle IO event processing. - void startSendingInternal(isc::asiolink::IOService & io_service); + void startSendingInternal(const isc::asiolink::IOServicePtr & io_service); /// @brief Queues the given request to be sent in a thread safe context. /// @@ -677,7 +675,7 @@ protected: /// /// @throw If the implementation encounters an error it MUST /// throw it as an isc::Exception or derivative. - virtual void open(isc::asiolink::IOService& io_service) = 0; + virtual void open(const isc::asiolink::IOServicePtr& io_service) = 0; /// @brief Abstract method which closes the IO sink. /// @@ -819,6 +817,16 @@ private: sending_ = value; } +protected: + + /// @brief Pointer to the IOService currently being used by the sender. + /// @note We need to remember the io_service but we receive it by + /// reference. Use a raw pointer to store it. This value should never be + /// exposed and is only valid while in send mode. + asiolink::IOServicePtr io_service_; + +private: + /// @brief Boolean indicator which tracks sending status. bool sending_; @@ -834,12 +842,6 @@ private: /// @brief Pointer to the request which is in the process of being sent. NameChangeRequestPtr ncr_to_send_; - /// @brief Pointer to the IOService currently being used by the sender. - /// @note We need to remember the io_service but we receive it by - /// reference. Use a raw pointer to store it. This value should never be - /// exposed and is only valid while in send mode. - asiolink::IOService* io_service_; - /// @brief The mutex used to protect internal state. const boost::scoped_ptr<std::mutex> mutex_; }; diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index c46307e657..f32404cb54 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -86,14 +86,16 @@ NameChangeUDPListener::~NameChangeUDPListener() { } void -NameChangeUDPListener::open(isc::asiolink::IOService& io_service) { +NameChangeUDPListener::open(const isc::asiolink::IOServicePtr& io_service) { // create our endpoint and bind the low level socket to it. isc::asiolink::UDPEndpoint endpoint(ip_address_, port_); + io_service_ = io_service; + // Create the low level socket. try { asio_socket_.reset(new boost::asio::ip::udp:: - socket(io_service.getInternalIOService(), + socket(io_service_->getInternalIOService(), (ip_address_.isV4() ? boost::asio::ip::udp::v4() : boost::asio::ip::udp::v6()))); @@ -106,6 +108,7 @@ NameChangeUDPListener::open(isc::asiolink::IOService& io_service) { asio_socket_->bind(endpoint.getASIOEndpoint()); } catch (const boost::system::system_error& ex) { asio_socket_.reset(); + io_service_.reset(); isc_throw (NcrUDPError, ex.code().message()); } @@ -147,6 +150,7 @@ NameChangeUDPListener::close() { } socket_.reset(); + io_service_.reset(); } void @@ -226,14 +230,16 @@ NameChangeUDPSender::~NameChangeUDPSender() { } void -NameChangeUDPSender::open(isc::asiolink::IOService& io_service) { +NameChangeUDPSender::open(const isc::asiolink::IOServicePtr& io_service) { // create our endpoint and bind the low level socket to it. isc::asiolink::UDPEndpoint endpoint(ip_address_, port_); + io_service_ = io_service; + // Create the low level socket. try { asio_socket_.reset(new boost::asio::ip::udp:: - socket(io_service.getInternalIOService(), + socket(io_service_->getInternalIOService(), (ip_address_.isV4() ? boost::asio::ip::udp::v4() : boost::asio::ip::udp::v6()))); @@ -245,6 +251,8 @@ NameChangeUDPSender::open(isc::asiolink::IOService& io_service) { // Bind the low level socket to our endpoint. asio_socket_->bind(endpoint.getASIOEndpoint()); } catch (const boost::system::system_error& ex) { + asio_socket_.reset(); + io_service_.reset(); isc_throw (NcrUDPError, ex.code().message()); } @@ -288,6 +296,7 @@ NameChangeUDPSender::close() { closeWatchSocket(); watch_socket_.reset(); + io_service_.reset(); } void diff --git a/src/lib/dhcp_ddns/ncr_udp.h b/src/lib/dhcp_ddns/ncr_udp.h index 01284aff7e..2b134238ba 100644 --- a/src/lib/dhcp_ddns/ncr_udp.h +++ b/src/lib/dhcp_ddns/ncr_udp.h @@ -110,7 +110,6 @@ #include <boost/shared_array.hpp> - /// responsibility of the completion handler to perform the steps necessary /// to interpret the raw data provided by the service outcome. The /// UDPCallback operator implementation is mostly a pass through. @@ -351,7 +350,7 @@ public: /// @param io_service the IOService which will monitor the socket. /// /// @throw NcrUDPError if the open fails. - virtual void open(isc::asiolink::IOService& io_service); + virtual void open(const isc::asiolink::IOServicePtr& io_service); /// @brief Closes the UDPSocket. /// @@ -397,7 +396,12 @@ public: /// the socket receive completion. void receiveCompletionHandler(const bool successful, const UDPCallback* recv_callback); + private: + + /// @brief The IO service used to handle events. + isc::asiolink::IOServicePtr io_service_; + /// @brief IP address on which to listen for requests. isc::asiolink::IOAddress ip_address_; @@ -431,7 +435,6 @@ private: //@} }; - /// @brief Provides the ability to send NameChangeRequests via UDP socket /// /// This class is a derivation of the NameChangeSender which is capable of @@ -469,7 +472,6 @@ public: /// @brief Destructor virtual ~NameChangeUDPSender(); - /// @brief Opens a UDP socket using the given IOService. /// /// Creates a NameChangeUDPSocket bound to the sender's IP address @@ -478,8 +480,7 @@ public: /// @param io_service the IOService which will monitor the socket. /// /// @throw NcrUDPError if the open fails. - virtual void open(isc::asiolink::IOService& io_service); - + virtual void open(const isc::asiolink::IOServicePtr& io_service); /// @brief Closes the UDPSocket. /// diff --git a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc index 758689b835..bb48609814 100644 --- a/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc +++ b/src/lib/dhcp_ddns/tests/ncr_udp_unittests.cc @@ -24,6 +24,7 @@ using namespace std; using namespace isc; +using namespace isc::asiolink; using namespace isc::util; using namespace isc::dhcp_ddns; @@ -88,9 +89,8 @@ public: /// 1. Given valid parameters, the listener constructor works TEST(NameChangeUDPListenerBasicTest, constructionTests) { // Verify the default constructor works. - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); + IOAddress ip_address(TEST_ADDRESS); uint32_t port = LISTENER_PORT; - isc::asiolink::IOService io_service; SimpleListenHandler ncr_handler; // Verify that valid constructor works. EXPECT_NO_THROW(NameChangeUDPListener(ip_address, port, FMT_JSON, @@ -105,9 +105,9 @@ TEST(NameChangeUDPListenerBasicTest, constructionTests) { /// 4. Return to the listening state after stopping TEST(NameChangeUDPListenerBasicTest, basicListenTests) { // Verify the default constructor works. - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); + IOAddress ip_address(TEST_ADDRESS); uint32_t port = LISTENER_PORT; - isc::asiolink::IOService io_service; + IOServicePtr io_service(new IOService()); SimpleListenHandler ncr_handler; NameChangeListenerPtr listener; @@ -134,7 +134,7 @@ TEST(NameChangeUDPListenerBasicTest, basicListenTests) { EXPECT_TRUE(listener->isIoPending()); // Verify that IO pending is false, after cancel event occurs. - EXPECT_NO_THROW(io_service.runOne()); + EXPECT_NO_THROW(io_service->runOne()); EXPECT_FALSE(listener->isIoPending()); // Verify that attempting to stop listening when we are not is ok. @@ -148,29 +148,28 @@ TEST(NameChangeUDPListenerBasicTest, basicListenTests) { /// @brief Compares two NameChangeRequests for equality. bool checkSendVsReceived(NameChangeRequestPtr sent_ncr, NameChangeRequestPtr received_ncr) { - return ((sent_ncr && received_ncr) && - (*sent_ncr == *received_ncr)); + return ((sent_ncr && received_ncr) && (*sent_ncr == *received_ncr)); } /// @brief Text fixture for testing NameChangeUDPListener class NameChangeUDPListenerTest : public virtual ::testing::Test, NameChangeListener::RequestReceiveHandler { public: - isc::asiolink::IOService io_service_; + IOServicePtr io_service_; NameChangeListener::Result result_; NameChangeRequestPtr sent_ncr_; NameChangeRequestPtr received_ncr_; NameChangeListenerPtr listener_; - isc::asiolink::IntervalTimer test_timer_; + IntervalTimer test_timer_; /// @brief Constructor // // Instantiates the listener member and the test timer. The timer is used // to ensure a test doesn't go awry and hang forever. NameChangeUDPListenerTest() - : io_service_(), result_(NameChangeListener::SUCCESS), + : io_service_(new IOService()), result_(NameChangeListener::SUCCESS), test_timer_(io_service_) { - isc::asiolink::IOAddress addr(TEST_ADDRESS); + IOAddress addr(TEST_ADDRESS); listener_.reset(new NameChangeUDPListener(addr, LISTENER_PORT, FMT_JSON, *this, true)); @@ -197,7 +196,7 @@ public: // Create a UDP socket through which our "sender" will send the NCR. boost::asio::ip::udp::socket - udp_socket(io_service_.getInternalIOService(), boost::asio::ip::udp::v4()); + udp_socket(io_service_->getInternalIOService(), boost::asio::ip::udp::v4()); // Create an endpoint pointed at the listener. boost::asio::ip::udp::endpoint @@ -228,7 +227,7 @@ public: /// /// This callback stops all running (hanging) tasks on IO service. void testTimeoutHandler() { - io_service_.stop(); + io_service_->stop(); FAIL() << "Test timeout hit."; } }; @@ -252,7 +251,7 @@ TEST_F(NameChangeUDPListenerTest, basicReceiveTests) { ASSERT_NO_THROW(sendNcr(valid_msgs[i])); // Execute no more then one event, which should be receive complete. - EXPECT_NO_THROW(io_service_.runOne()); + EXPECT_NO_THROW(io_service_->runOne()); // Verify the "application" status value for a successful complete. EXPECT_EQ(NameChangeListener::SUCCESS, result_); @@ -268,7 +267,7 @@ TEST_F(NameChangeUDPListenerTest, basicReceiveTests) { EXPECT_FALSE(listener_->amListening()); // Verify that IO pending is false, after cancel event occurs. - EXPECT_NO_THROW(io_service_.runOne()); + EXPECT_NO_THROW(io_service_->runOne()); EXPECT_FALSE(listener_->isIoPending()); } @@ -312,9 +311,8 @@ public: /// 3. Default construction provides default max queue size /// 4. Construction with a custom max queue size works TEST_F(NameChangeUDPSenderBasicTest, constructionTests) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); + IOAddress ip_address(TEST_ADDRESS); uint32_t port = SENDER_PORT; - isc::asiolink::IOService io_service; SimpleSendHandler ncr_handler; // Verify that constructing with an queue size of zero is not allowed. @@ -349,9 +347,8 @@ TEST_F(NameChangeUDPSenderBasicTest, constructionTestsMultiThreading) { // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); + IOAddress ip_address(TEST_ADDRESS); uint32_t port = SENDER_PORT; - isc::asiolink::IOService io_service; SimpleSendHandler ncr_handler; // Verify that constructing with an queue size of zero is not allowed. @@ -378,8 +375,8 @@ TEST_F(NameChangeUDPSenderBasicTest, constructionTestsMultiThreading) { /// @brief Tests NameChangeUDPSender basic send functionality TEST_F(NameChangeUDPSenderBasicTest, basicSendTests) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Tests are based on a list of messages, get the count now. @@ -506,8 +503,8 @@ TEST_F(NameChangeUDPSenderBasicTest, basicSendTestsMultiThreading) { // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Tests are based on a list of messages, get the count now. @@ -632,8 +629,8 @@ TEST_F(NameChangeUDPSenderBasicTest, basicSendTestsMultiThreading) { /// @brief Tests that sending gets kick-started if the queue isn't empty /// when startSending is called. TEST_F(NameChangeUDPSenderBasicTest, autoStart) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Tests are based on a list of messages, get the count now. @@ -687,8 +684,8 @@ TEST_F(NameChangeUDPSenderBasicTest, autoStartMultiThreading) { // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Tests are based on a list of messages, get the count now. @@ -738,9 +735,9 @@ TEST_F(NameChangeUDPSenderBasicTest, autoStartMultiThreading) { /// @brief Tests NameChangeUDPSender basic send with INADDR_ANY and port 0. TEST_F(NameChangeUDPSenderBasicTest, anyAddressSend) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOAddress any_address("0.0.0.0"); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOAddress any_address("0.0.0.0"); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Tests are based on a list of messages, get the count now. @@ -776,9 +773,9 @@ TEST_F(NameChangeUDPSenderBasicTest, anyAddressSendMultiThreading) { // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOAddress any_address("0.0.0.0"); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOAddress any_address("0.0.0.0"); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Tests are based on a list of messages, get the count now. @@ -811,9 +808,9 @@ TEST_F(NameChangeUDPSenderBasicTest, anyAddressSendMultiThreading) { /// @brief Test the NameChangeSender::assumeQueue method. TEST_F(NameChangeUDPSenderBasicTest, assumeQueue) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); + IOAddress ip_address(TEST_ADDRESS); uint32_t port = SENDER_PORT; - isc::asiolink::IOService io_service; + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; NameChangeRequestPtr ncr; @@ -883,9 +880,9 @@ TEST_F(NameChangeUDPSenderBasicTest, assumeQueueMultiThreading) { // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); + IOAddress ip_address(TEST_ADDRESS); uint32_t port = SENDER_PORT; - isc::asiolink::IOService io_service; + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; NameChangeRequestPtr ncr; @@ -957,20 +954,20 @@ class NameChangeUDPTest : public virtual ::testing::Test, NameChangeListener::RequestReceiveHandler, NameChangeSender::RequestSendHandler { public: - isc::asiolink::IOService io_service_; + IOServicePtr io_service_; NameChangeListener::Result recv_result_; NameChangeSender::Result send_result_; NameChangeListenerPtr listener_; NameChangeSenderPtr sender_; - isc::asiolink::IntervalTimer test_timer_; + IntervalTimer test_timer_; std::vector<NameChangeRequestPtr> sent_ncrs_; std::vector<NameChangeRequestPtr> received_ncrs_; NameChangeUDPTest() - : io_service_(), recv_result_(NameChangeListener::SUCCESS), + : io_service_(new IOService()), recv_result_(NameChangeListener::SUCCESS), send_result_(NameChangeSender::SUCCESS), test_timer_(io_service_) { - isc::asiolink::IOAddress addr(TEST_ADDRESS); + IOAddress addr(TEST_ADDRESS); // Create our listener instance. Note that reuse_address is true. listener_.reset( new NameChangeUDPListener(addr, LISTENER_PORT, FMT_JSON, @@ -1019,7 +1016,7 @@ public: /// /// This callback stops all running (hanging) tasks on IO service. void testTimeoutHandler() { - io_service_.stop(); + io_service_->stop(); FAIL() << "Test timeout hit."; } @@ -1098,7 +1095,7 @@ TEST_F(NameChangeUDPTest, roundTripTest) { // Execute callbacks until we have sent and received all of messages. while (sender_->getQueueSize() > 0 || (received_ncrs_.size() < num_msgs)) { - EXPECT_NO_THROW(io_service_.runOne()); + EXPECT_NO_THROW(io_service_->runOne()); } // Send queue should be empty. @@ -1116,7 +1113,7 @@ TEST_F(NameChangeUDPTest, roundTripTest) { EXPECT_FALSE(listener_->amListening()); // Verify that IO pending is false, after cancel event occurs. - EXPECT_NO_THROW(io_service_.runOne()); + EXPECT_NO_THROW(io_service_->runOne()); EXPECT_FALSE(listener_->isIoPending()); // Verify that we can gracefully stop sending. @@ -1152,7 +1149,7 @@ TEST_F(NameChangeUDPTest, roundTripTestMultiThreading) { // Execute callbacks until we have sent and received all of messages. while (sender_->getQueueSize() > 0 || (received_ncrs_.size() < num_msgs)) { - EXPECT_NO_THROW(io_service_.runOne()); + EXPECT_NO_THROW(io_service_->runOne()); } // Send queue should be empty. @@ -1171,7 +1168,7 @@ TEST_F(NameChangeUDPTest, roundTripTestMultiThreading) { EXPECT_FALSE(listener_->amListening()); // Verify that IO pending is false, after cancel event occurs. - EXPECT_NO_THROW(io_service_.runOne()); + EXPECT_NO_THROW(io_service_->runOne()); EXPECT_FALSE(listener_->isIoPending()); // Verify that we can gracefully stop sending. @@ -1182,8 +1179,8 @@ TEST_F(NameChangeUDPTest, roundTripTestMultiThreading) { // Tests error handling of a failure to mark the watch socket ready, when // sendRequest() is called. TEST_F(NameChangeUDPSenderBasicTest, watchClosedBeforeSendRequest) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Create the sender and put into send mode. @@ -1217,8 +1214,8 @@ TEST_F(NameChangeUDPSenderBasicTest, watchClosedBeforeSendRequestMultiThreading) // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Create the sender and put into send mode. @@ -1249,8 +1246,8 @@ TEST_F(NameChangeUDPSenderBasicTest, watchClosedBeforeSendRequestMultiThreading) // Tests error handling of a failure to mark the watch socket ready, when // sendNext() is called during completion handling. TEST_F(NameChangeUDPSenderBasicTest, watchClosedAfterSendRequest) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Create the sender and put into send mode. @@ -1291,8 +1288,8 @@ TEST_F(NameChangeUDPSenderBasicTest, watchClosedAfterSendRequestMultiThreading) // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Create the sender and put into send mode. @@ -1331,8 +1328,8 @@ TEST_F(NameChangeUDPSenderBasicTest, watchClosedAfterSendRequestMultiThreading) // Tests error handling of a failure to clear the watch socket during // completion handling. TEST_F(NameChangeUDPSenderBasicTest, watchSocketBadRead) { - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Create the sender and put into send mode. @@ -1382,8 +1379,8 @@ TEST_F(NameChangeUDPSenderBasicTest, watchSocketBadReadMultiThreading) { // Enable multi-threading MultiThreadingMgr::instance().setMode(true); - isc::asiolink::IOAddress ip_address(TEST_ADDRESS); - isc::asiolink::IOService io_service; + IOAddress ip_address(TEST_ADDRESS); + IOServicePtr io_service(new IOService()); SimpleSendHandler ncr_handler; // Create the sender and put into send mode. |