BIND 10 trac1238, updated. b09fdcc6b45d4580b138cc9f59bfc051bd6ad360 [1238] Sockets are now closed properly.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Dec 5 16:59:46 UTC 2011
The branch, trac1238 has been updated
via b09fdcc6b45d4580b138cc9f59bfc051bd6ad360 (commit)
from 4d97ef5cdb4833a7a36b6679c16338505b07d4e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b09fdcc6b45d4580b138cc9f59bfc051bd6ad360
Author: Tomek Mrugalski <tomasz at isc.org>
Date: Mon Dec 5 17:59:21 2011 +0100
[1238] Sockets are now closed properly.
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp6/dhcp6_srv.cc | 2 ++
src/bin/dhcp6/dhcp6_srv.h | 2 +-
src/bin/dhcp6/iface_mgr.cc | 8 ++++++--
src/bin/dhcp6/iface_mgr.h | 5 +++++
4 files changed, 14 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc
index f8b467b..d5a969f 100644
--- a/src/bin/dhcp6/dhcp6_srv.cc
+++ b/src/bin/dhcp6/dhcp6_srv.cc
@@ -47,6 +47,8 @@ Dhcpv6Srv::Dhcpv6Srv(uint16_t port) {
Dhcpv6Srv::~Dhcpv6Srv() {
cout << "DHCPv6 Srv shutdown." << endl;
+
+ IfaceMgr::instance().closeSockets();
}
bool
diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h
index c90d00d..bcc7818 100644
--- a/src/bin/dhcp6/dhcp6_srv.h
+++ b/src/bin/dhcp6/dhcp6_srv.h
@@ -47,7 +47,7 @@ public:
Dhcpv6Srv(uint16_t port = DHCP6_SERVER_PORT);
/// @brief Destructor. Used during DHCPv6 service shutdown.
- ~Dhcpv6Srv();
+ virtual ~Dhcpv6Srv();
/// @brief Returns server-intentifier option
///
diff --git a/src/bin/dhcp6/iface_mgr.cc b/src/bin/dhcp6/iface_mgr.cc
index f7395ee..b28b9f0 100644
--- a/src/bin/dhcp6/iface_mgr.cc
+++ b/src/bin/dhcp6/iface_mgr.cc
@@ -134,8 +134,7 @@ IfaceMgr::IfaceMgr()
}
}
-IfaceMgr::~IfaceMgr() {
-
+void IfaceMgr::closeSockets() {
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end(); ++iface) {
@@ -147,6 +146,11 @@ IfaceMgr::~IfaceMgr() {
iface->sockets_.clear();
}
+}
+
+IfaceMgr::~IfaceMgr() {
+ closeSockets();
+
// control_buf_ is deleted automatically (scoped_ptr)
control_buf_len_ = 0;
}
diff --git a/src/bin/dhcp6/iface_mgr.h b/src/bin/dhcp6/iface_mgr.h
index 6700993..a8d70d9 100644
--- a/src/bin/dhcp6/iface_mgr.h
+++ b/src/bin/dhcp6/iface_mgr.h
@@ -301,6 +301,11 @@ public:
/// @param port specifies port number (usually DHCP6_SERVER_PORT)
void openSockets(uint16_t port);
+
+ /// @brief Closes all open sockets.
+ /// Is used in destructor, but also from Dhcpv4_srv and Dhcpv6_srv classes.
+ void closeSockets();
+
// don't use private, we need derived classes in tests
protected:
More information about the bind10-changes
mailing list