BIND 10 trac2187, updated. 5633225648b2a4a5582327131f9ca7a7d83b340f [2187] Throw exception if packet sending failed.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Sep 25 14:06:20 UTC 2012


The branch, trac2187 has been updated
       via  5633225648b2a4a5582327131f9ca7a7d83b340f (commit)
      from  8a1be35939e817930570e4afc76af240e78c2602 (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 5633225648b2a4a5582327131f9ca7a7d83b340f
Author: Marcin Siodelski <marcin at isc.org>
Date:   Tue Sep 25 16:06:06 2012 +0200

    [2187] Throw exception if packet sending failed.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dhcp/iface_mgr.cc                |    4 ++--
 src/lib/dhcp/tests/iface_mgr_unittest.cc |    4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index 3ce6434..35f8c7d 100644
--- a/src/lib/dhcp/iface_mgr.cc
+++ b/src/lib/dhcp/iface_mgr.cc
@@ -702,7 +702,7 @@ IfaceMgr::send(const Pkt6Ptr& pkt) {
 
     result = sendmsg(getSocket(*pkt), &m, 0);
     if (result < 0) {
-        isc_throw(Unexpected, "Pkt6 send failed: sendmsg() returned " << result);
+        isc_throw(SocketWriteError, "Pkt6 send failed: sendmsg() returned " << result);
     }
 
     return (result);
@@ -752,7 +752,7 @@ IfaceMgr::send(const Pkt4Ptr& pkt)
 
     int result = sendmsg(getSocket(*pkt), &m, 0);
     if (result < 0) {
-        isc_throw(Unexpected, "Pkt4 send failed.");
+        isc_throw(SocketWriteError, "pkt4 send failed");
     }
 
     return (result);
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index 49f695c..9ca7899 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -639,10 +639,11 @@ TEST_F(IfaceMgrTest, sendReceive6) {
     // we should accept both values as source ports.
     EXPECT_TRUE((rcvPkt->getRemotePort() == 10546) || (rcvPkt->getRemotePort() == 10547));
 
-    // try to receive data over the closed socket. Closed socket's descriptor is
+    // try to send/receive data over the closed socket. Closed socket's descriptor is
     // still being hold by IfaceMgr which will try to use it to receive data.
     close(socket1);
     EXPECT_THROW(ifacemgr->receive6(10), SocketReadError);
+    EXPECT_THROW(ifacemgr->send(sendPkt), SocketWriteError);
 }
 
 TEST_F(IfaceMgrTest, sendReceive4) {
@@ -736,6 +737,7 @@ TEST_F(IfaceMgrTest, sendReceive4) {
     // still being hold by IfaceMgr which will try to use it to receive data.
     close(socket1);
     EXPECT_THROW(ifacemgr->receive4(10), SocketReadError);
+    EXPECT_THROW(ifacemgr->send(sendPkt), SocketWriteError);
 }
 
 



More information about the bind10-changes mailing list