diff options
author | Marcin Siodelski <marcin@isc.org> | 2015-08-24 14:25:15 +0200 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2015-08-24 14:25:15 +0200 |
commit | c3a1e5668e5af72e45d1240661e9de5a8156ee6b (patch) | |
tree | a5fc144bd3de1a12303f037d087216c4c68f229a /src/lib/dhcp_ddns | |
parent | [3970] Moved WatchSocket class to utilities. (diff) | |
download | kea-c3a1e5668e5af72e45d1240661e9de5a8156ee6b.tar.xz kea-c3a1e5668e5af72e45d1240661e9de5a8156ee6b.zip |
[3970] Propagate errors emitted when closing the WatchSocket.
Diffstat (limited to 'src/lib/dhcp_ddns')
-rw-r--r-- | src/lib/dhcp_ddns/dhcp_ddns_messages.mes | 14 | ||||
-rw-r--r-- | src/lib/dhcp_ddns/ncr_udp.cc | 14 | ||||
-rw-r--r-- | src/lib/dhcp_ddns/ncr_udp.h | 7 |
3 files changed, 24 insertions, 11 deletions
diff --git a/src/lib/dhcp_ddns/dhcp_ddns_messages.mes b/src/lib/dhcp_ddns/dhcp_ddns_messages.mes index fd0091a368..b379d477d5 100644 --- a/src/lib/dhcp_ddns/dhcp_ddns_messages.mes +++ b/src/lib/dhcp_ddns/dhcp_ddns_messages.mes @@ -89,14 +89,8 @@ caught in the application's send completion handler. This is a programmatic error that needs to be reported. Dependent upon the nature of the error the client may or may not continue operating normally. -% DHCP_DDNS_WATCH_SINK_CLOSE_ERROR Sink-side watch socket failed to close: %1 +% DHCP_DDNS_UDP_SENDER_WATCH_SOCKET_CLOSE_ERROR watch socket failed to close: %1 This is an error message that indicates the application was unable to close -the inbound side of a NCR sender's watch socket. While technically possible -this error is highly unlikely to occur and should not impair the application's -ability to process requests. - -% DHCP_DDNS_WATCH_SOURCE_CLOSE_ERROR Source-side watch socket failed to close: %1 -This is an error message that indicates the application was unable to close -the outbound side of a NCR sender's watch socket. While technically possible -this error is highly unlikely to occur and should not impair the application's -ability to process requests. +the inbound or outbound side of a NCR sender's watch socket. While technically +possible the error is highly unlikely to occur and should not impair the +application's ability to process requests. diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc index 683147f04b..28e665f8d6 100644 --- a/src/lib/dhcp_ddns/ncr_udp.cc +++ b/src/lib/dhcp_ddns/ncr_udp.cc @@ -260,6 +260,7 @@ NameChangeUDPSender::open(isc::asiolink::IOService& io_service) { send_callback_->setDataSource(server_endpoint_); + closeWatchSocket(); watch_socket_.reset(new util::WatchSocket()); } @@ -288,6 +289,7 @@ NameChangeUDPSender::close() { socket_.reset(); + closeWatchSocket(); watch_socket_.reset(); } @@ -372,7 +374,17 @@ NameChangeUDPSender::ioReady() { return (false); } - +void +NameChangeUDPSender::closeWatchSocket() { + if (watch_socket_) { + std::string error_string; + watch_socket_->closeSocket(error_string); + if (!error_string.empty()) { + LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_UDP_SENDER_WATCH_SOCKET_CLOSE_ERROR) + .arg(error_string); + } + } +} }; // end of isc::dhcp_ddns namespace }; // end of isc namespace diff --git a/src/lib/dhcp_ddns/ncr_udp.h b/src/lib/dhcp_ddns/ncr_udp.h index 89646d118c..c927f9220e 100644 --- a/src/lib/dhcp_ddns/ncr_udp.h +++ b/src/lib/dhcp_ddns/ncr_udp.h @@ -548,6 +548,13 @@ public: virtual bool ioReady(); private: + + /// @brief Closes watch socket if the socket is open. + /// + /// This method closes watch socket if its instance exists and if the + /// socket is open. An error message is logged when this operation fails. + void closeWatchSocket(); + /// @brief IP address from which to send. isc::asiolink::IOAddress ip_address_; |