]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
perfdhcp: renamed BetterSocket to PerfSocket, replaced std::mutex with isc::util...
authorMichal Nowikowski <godfryd@isc.org>
Thu, 17 Jan 2019 15:48:06 +0000 (16:48 +0100)
committerMichal Nowikowski <godfryd@isc.org>
Fri, 18 Jan 2019 09:05:12 +0000 (10:05 +0100)
src/bin/perfdhcp/Makefile.am
src/bin/perfdhcp/command_options.cc
src/bin/perfdhcp/perf_socket.cc [moved from src/bin/perfdhcp/better_socket.cc with 88% similarity]
src/bin/perfdhcp/perf_socket.h [moved from src/bin/perfdhcp/better_socket.h with 86% similarity]
src/bin/perfdhcp/receiver.cc
src/bin/perfdhcp/receiver.h
src/bin/perfdhcp/test_control.cc
src/bin/perfdhcp/test_control.h
src/bin/perfdhcp/tests/receiver_unittest.cc
src/bin/perfdhcp/tests/test_control_unittest.cc

index 6bdb74ffdfd3af86bfed50318ccb2f37fc92d517..b6b927993ed98eaa6c3738ad3927dfb17eefdfbd 100644 (file)
@@ -26,7 +26,7 @@ libperfdhcp_la_SOURCES += rate_control.cc rate_control.h
 libperfdhcp_la_SOURCES += stats_mgr.h
 libperfdhcp_la_SOURCES += test_control.cc test_control.h
 libperfdhcp_la_SOURCES += receiver.cc receiver.h
-libperfdhcp_la_SOURCES += better_socket.cc better_socket.h
+libperfdhcp_la_SOURCES += perf_socket.cc perf_socket.h
 
 sbin_PROGRAMS = perfdhcp
 perfdhcp_SOURCES = main.cc
index 87add9da685f2c23323abeb8860f8c8b396098da..b5b7039701d4983bd363f6d7fa0f8febea891cd2 100644 (file)
@@ -1107,10 +1107,10 @@ CommandOptions::usage() const {
         "    with the exchange rate (given by -r<rate>).  Furthermore the sum of\n"
         "    this value and the release-rate (given by -F<rate) must be equal\n"
         "    to or less than the exchange rate.\n"
-        "-g  Select thread mode: 'single' or 'multi'. In multi-thread mode packets\n"
-        "    are received in separate thread. This allows better utilisation of CPUs."
-        "    If more than 1 CPU is present then multi-thread mode is the default,"
-        "    otherwise single-thread is the default."
+        "-g: Select thread mode: 'single' or 'multi'. In multi-thread mode packets\n"
+        "    are received in separate thread. This allows better utilisation of CPUs.\n"
+        "    If more than 1 CPU is present then multi-thread mode is the default,\n"
+        "    otherwise single-thread is the default.\n"
         "-h: Print this help.\n"
         "-i: Do only the initial part of an exchange: DO or SA, depending on\n"
         "    whether -6 is given.\n"
similarity index 88%
rename from src/bin/perfdhcp/better_socket.cc
rename to src/bin/perfdhcp/perf_socket.cc
index ace47235f9eb6ea6206ecee869480e85e779c098..c5b01cfa2e4111b6ce52e7d1c43231ff85607c63 100644 (file)
@@ -5,7 +5,7 @@
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
-#include <perfdhcp/better_socket.h>
+#include <perfdhcp/perf_socket.h>
 
 #include <dhcp/iface_mgr.h>
 
@@ -17,7 +17,7 @@ using namespace isc::dhcp;
 namespace isc {
 namespace perfdhcp {
 
-BetterSocket::BetterSocket(const int socket) :
+PerfSocket::PerfSocket(const int socket) :
 SocketInfo(asiolink::IOAddress("127.0.0.1"), 0, socket),
     ifindex_(0), valid_(true) {
     try {
@@ -27,7 +27,7 @@ SocketInfo(asiolink::IOAddress("127.0.0.1"), 0, socket),
     }
 }
 
-BetterSocket::~BetterSocket() {
+PerfSocket::~PerfSocket() {
     IfacePtr iface = IfaceMgr::instance().getIface(ifindex_);
     if (iface) {
         iface->delSocket(sockfd_);
@@ -35,7 +35,7 @@ BetterSocket::~BetterSocket() {
 }
 
 void
-BetterSocket::initSocketData() {
+PerfSocket::initSocketData() {
     BOOST_FOREACH(IfacePtr iface, IfaceMgr::instance().getIfaces()) {
         BOOST_FOREACH(SocketInfo s, iface->getSockets()) {
             if (s.sockfd_ == sockfd_) {
similarity index 86%
rename from src/bin/perfdhcp/better_socket.h
rename to src/bin/perfdhcp/perf_socket.h
index 4ed678ff280d7626408b85f04592360fbeb1dc65..de593d317f48bacdb1924bd3bcbf091d0a50f557 100644 (file)
@@ -1,11 +1,11 @@
-// Copyright (C) 2012-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-#ifndef BETTER_SOCKET_H
-#define BETTER_SOCKET_H
+#ifndef PERF_SOCKET_H
+#define PERF_SOCKET_H
 
 #include <dhcp/socket_info.h>
 
@@ -22,7 +22,7 @@ namespace perfdhcp {
 /// when exception occurs). This structure extends parent
 /// structure with new field ifindex_ that holds interface
 /// index where socket is bound to.
-struct BetterSocket : public dhcp::SocketInfo {
+struct PerfSocket : public dhcp::SocketInfo {
     /// Interface index.
     uint16_t ifindex_;
     /// Is socket valid. It will not be valid if the provided socket
@@ -37,12 +37,12 @@ struct BetterSocket : public dhcp::SocketInfo {
     /// valid_ field is set to false;
     ///
     /// \param socket socket descriptor.
-    BetterSocket(const int socket);
+    PerfSocket(const int socket);
 
     /// \brief Destructor of the socket wrapper class.
     ///
     /// Destructor closes wrapped socket.
-    virtual ~BetterSocket();
+    virtual ~PerfSocket();
 
 private:
     /// \brief Initialize socket data.
@@ -58,4 +58,4 @@ private:
 }
 }
 
-#endif /* BETTER_SOCKET_H */
+#endif /* PERF_SOCKET_H */
index adbf905c85ca8469b14bf74ddc1009e3c548293e..68cff6bfd1e060f5186897568288e66cae2c20b0 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <perfdhcp/receiver.h>
 #include <perfdhcp/command_options.h>
-#include <util/threads/thread.h>
 
 #include <dhcp/iface_mgr.h>
 
@@ -60,7 +59,7 @@ Receiver::getPkt() {
         return readPktFromSocket();
     } else {
         // In multi thread mode read packet from the queue which is feed by Receiver thread.
-        unique_lock<mutex> lock(pkt_queue_mutex_);
+        util::thread::Mutex::Locker lock(pkt_queue_mutex_);
         if (pkt_queue_.empty()) {
             if (CommandOptions::instance().getIpVersion() == 4) {
                 return Pkt4Ptr();
@@ -140,7 +139,7 @@ Receiver::receivePackets() {
         if (pkt->getType() == DHCPOFFER || pkt->getType() == DHCPACK ||
             pkt->getType() == DHCPV6_ADVERTISE || pkt->getType() == DHCPV6_REPLY) {
             // Otherwise push the packet to the queue, to main thread.
-            unique_lock<mutex> lock(pkt_queue_mutex_);
+            util::thread::Mutex::Locker lock(pkt_queue_mutex_);
             pkt_queue_.push(pkt);
         }
     }
index 482972c7561133fd577fc8616a2a3239cf4d2bc6..d05ee2493a8521684946a60521d20f0ede03f00a 100644 (file)
@@ -7,15 +7,15 @@
 #ifndef PERFDHCP_RECEIVER_H
 #define PERFDHCP_RECEIVER_H
 
-#include <perfdhcp/better_socket.h>
+#include <perfdhcp/perf_socket.h>
 #include <perfdhcp/command_options.h>
 
 #include <dhcp/pkt.h>
 #include <util/threads/thread.h>
+#include <util/threads/sync.h>
 
 #include <queue>
 #include <thread>
-#include <mutex>
 #include <boost/atomic.hpp>
 
 namespace isc {
@@ -35,7 +35,7 @@ namespace perfdhcp {
 class Receiver {
 public:
     /// \brief Socket for receiving.
-    const BetterSocket& socket_;
+    const PerfSocket& socket_;
 
 private:
     /// \brief Flag indicating if thread should run (true) or not (false).
@@ -48,7 +48,7 @@ private:
     std::queue<dhcp::PktPtr> pkt_queue_;
 
     /// \brief Mutex for controlling access to the queue.
-    std::mutex pkt_queue_mutex_;
+    util::thread::Mutex pkt_queue_mutex_;
 
     /// \brief Single- or thread-mode indicator.
     bool single_threaded_;
@@ -57,7 +57,7 @@ public:
     /// \brief Receiver constructor.
     ///
     /// \param socket A socket for receiving packets.
-    Receiver(const BetterSocket& socket) :
+    Receiver(const PerfSocket& socket) :
         socket_(socket),
         single_threaded_(CommandOptions::instance().isSingleThreaded()) {
     }
index c1a9b665bce1b8b6e70a69a75de028c003b61867..ce4ff1f61d5e7ddbed310e4ec8bbe49029603c4d 100644 (file)
@@ -858,7 +858,7 @@ TestControl::openSocket() const {
 }
 
 void
-TestControl::sendPackets(const BetterSocket& socket,
+TestControl::sendPackets(const PerfSocket& socket,
                          const uint64_t packets_num,
                          const bool preload /* = false */) {
     CommandOptions& options = CommandOptions::instance();
@@ -888,7 +888,7 @@ TestControl::sendPackets(const BetterSocket& socket,
 }
 
 uint64_t
-TestControl::sendMultipleRequests(const BetterSocket& socket,
+TestControl::sendMultipleRequests(const PerfSocket& socket,
                                   const uint64_t msg_num) {
     for (uint64_t i = 0; i < msg_num; ++i) {
         if (!sendRequestFromAck(socket)) {
@@ -899,7 +899,7 @@ TestControl::sendMultipleRequests(const BetterSocket& socket,
 }
 
 uint64_t
-TestControl::sendMultipleMessages6(const BetterSocket& socket,
+TestControl::sendMultipleMessages6(const PerfSocket& socket,
                                    const uint32_t msg_type,
                                    const uint64_t msg_num) {
     for (uint64_t i = 0; i < msg_num; ++i) {
@@ -1137,7 +1137,7 @@ TestControl::readPacketTemplate(const std::string& file_name) {
 }
 
 void
-TestControl::processReceivedPacket4(const BetterSocket& socket,
+TestControl::processReceivedPacket4(const PerfSocket& socket,
                             const Pkt4Ptr& pkt4) {
     if (pkt4->getType() == DHCPOFFER) {
         Pkt4Ptr discover_pkt4(stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_DO,
@@ -1180,7 +1180,7 @@ TestControl::processReceivedPacket4(const BetterSocket& socket,
 }
 
 void
-TestControl::processReceivedPacket6(const BetterSocket& socket,
+TestControl::processReceivedPacket6(const PerfSocket& socket,
                             const Pkt6Ptr& pkt6) {
     uint8_t packet_type = pkt6->getType();
     if (packet_type == DHCPV6_ADVERTISE) {
@@ -1236,7 +1236,7 @@ TestControl::processReceivedPacket6(const BetterSocket& socket,
 }
 
 unsigned int
-TestControl::consumeReceivedPackets(Receiver& receiver, const BetterSocket& socket) {
+TestControl::consumeReceivedPackets(Receiver& receiver, const PerfSocket& socket) {
     unsigned int pkt_count = 0;
     PktPtr pkt;
     while ((pkt = receiver.getPkt())) {
@@ -1374,7 +1374,7 @@ TestControl::run() {
     printDiagnostics();
     // Option factories have to be registered.
     registerOptionFactories();
-    BetterSocket socket(openSocket());
+    PerfSocket socket(openSocket());
     if (!socket.valid_) {
         isc_throw(Unexpected, "invalid socket descriptor");
     }
@@ -1430,6 +1430,7 @@ TestControl::run() {
         // CPU idle for a moment, to not consume 100% CPU all the time
         // but only if it is not that high request rate expected.
         if (options.getRate() < 10000 && packets_due == 0 && pkt_count == 0) {
+            // @todo: need to implement adaptive time here, so the sleep time is not fixed, but adjusts to current situation.
             usleep(1);
         }
 
@@ -1560,7 +1561,7 @@ TestControl::saveFirstPacket(const Pkt6Ptr& pkt) {
 }
 
 void
-TestControl::sendDiscover4(const BetterSocket& socket,
+TestControl::sendDiscover4(const PerfSocket& socket,
                            const bool preload /*= false*/) {
     // Generate the MAC address to be passed in the packet.
     uint8_t randomized = 0;
@@ -1609,7 +1610,7 @@ TestControl::sendDiscover4(const BetterSocket& socket,
 }
 
 void
-TestControl::sendDiscover4(const BetterSocket& socket,
+TestControl::sendDiscover4(const PerfSocket& socket,
                            const std::vector<uint8_t>& template_buf,
                            const bool preload /* = false */) {
     // Get the first argument if multiple the same arguments specified
@@ -1660,7 +1661,7 @@ TestControl::sendDiscover4(const BetterSocket& socket,
 }
 
 bool
-TestControl::sendRequestFromAck(const BetterSocket& socket) {
+TestControl::sendRequestFromAck(const PerfSocket& socket) {
     // Get one of the recorded DHCPACK messages.
     Pkt4Ptr ack = ack_storage_.getRandom();
     if (!ack) {
@@ -1688,7 +1689,7 @@ TestControl::sendRequestFromAck(const BetterSocket& socket) {
 
 bool
 TestControl::sendMessageFromReply(const uint16_t msg_type,
-                                  const BetterSocket& socket) {
+                                  const PerfSocket& socket) {
     // We only permit Release or Renew messages to be sent using this function.
     if (msg_type != DHCPV6_RENEW && msg_type != DHCPV6_RELEASE) {
         isc_throw(isc::BadValue, "invalid message type " << msg_type
@@ -1718,7 +1719,7 @@ TestControl::sendMessageFromReply(const uint16_t msg_type,
 }
 
 void
-TestControl::sendRequest4(const BetterSocket& socket,
+TestControl::sendRequest4(const PerfSocket& socket,
                           const dhcp::Pkt4Ptr& discover_pkt4,
                           const dhcp::Pkt4Ptr& offer_pkt4) {
     // Use the same transaction id as the one used in the discovery packet.
@@ -1784,7 +1785,7 @@ TestControl::sendRequest4(const BetterSocket& socket,
 }
 
 void
-TestControl::sendRequest4(const BetterSocket& socket,
+TestControl::sendRequest4(const PerfSocket& socket,
                           const std::vector<uint8_t>& template_buf,
                           const dhcp::Pkt4Ptr& discover_pkt4,
                           const dhcp::Pkt4Ptr& offer_pkt4) {
@@ -1898,7 +1899,7 @@ TestControl::sendRequest4(const BetterSocket& socket,
 }
 
 void
-TestControl::sendRequest6(const BetterSocket& socket,
+TestControl::sendRequest6(const PerfSocket& socket,
                           const Pkt6Ptr& advertise_pkt6) {
     const uint32_t transid = generateTransid();
     Pkt6Ptr pkt6(new Pkt6(DHCPV6_REQUEST, transid));
@@ -1955,7 +1956,7 @@ TestControl::sendRequest6(const BetterSocket& socket,
 }
 
 void
-TestControl::sendRequest6(const BetterSocket& socket,
+TestControl::sendRequest6(const PerfSocket& socket,
                           const std::vector<uint8_t>& template_buf,
                           const Pkt6Ptr& advertise_pkt6) {
     // Get the second argument if multiple the same arguments specified
@@ -2074,7 +2075,7 @@ TestControl::sendRequest6(const BetterSocket& socket,
 }
 
 void
-TestControl::sendSolicit6(const BetterSocket& socket,
+TestControl::sendSolicit6(const PerfSocket& socket,
                           const bool preload /*= false*/) {
     // Generate DUID to be passed to the packet
     uint8_t randomized = 0;
@@ -2125,7 +2126,7 @@ TestControl::sendSolicit6(const BetterSocket& socket,
 }
 
 void
-TestControl::sendSolicit6(const BetterSocket& socket,
+TestControl::sendSolicit6(const PerfSocket& socket,
                           const std::vector<uint8_t>& template_buf,
                           const bool preload /*= false*/) {
     const int arg_idx = 0;
@@ -2174,7 +2175,7 @@ TestControl::sendSolicit6(const BetterSocket& socket,
 
 
 void
-TestControl::setDefaults4(const BetterSocket& socket,
+TestControl::setDefaults4(const PerfSocket& socket,
                           const Pkt4Ptr& pkt) {
     CommandOptions& options = CommandOptions::instance();
     // Interface name.
@@ -2200,7 +2201,7 @@ TestControl::setDefaults4(const BetterSocket& socket,
 }
 
 void
-TestControl::setDefaults6(const BetterSocket& socket,
+TestControl::setDefaults6(const PerfSocket& socket,
                           const Pkt6Ptr& pkt) {
     CommandOptions& options = CommandOptions::instance();
     // Interface name.
index 9849bc47752ff247653c181a2c16ba55b1511a33..0606a21de85003fff8fa7ff9b56536642e4a0284 100644 (file)
@@ -523,7 +523,7 @@ protected:
     /// \brief Pull packets from receiver and process them.
 
     /// It runs in a loop until there are no packets in receiver.
-    unsigned int consumeReceivedPackets(Receiver& receiver, const BetterSocket& socket);
+    unsigned int consumeReceivedPackets(Receiver& receiver, const PerfSocket& socket);
 
     /// \brief Process received DHCPv4 packet.
     ///
@@ -539,7 +539,7 @@ protected:
     /// \param [in] pkt4 object representing DHCPv4 packet received.
     /// \throw isc::BadValue if unknown message type received.
     /// \throw isc::Unexpected if unexpected error occurred.
-    void processReceivedPacket4(const BetterSocket& socket,
+    void processReceivedPacket4(const PerfSocket& socket,
                                 const dhcp::Pkt4Ptr& pkt4);
 
     /// \brief Process received DHCPv6 packet.
@@ -556,7 +556,7 @@ protected:
     /// \param [in] pkt6 object representing DHCPv6 packet received.
     /// \throw isc::BadValue if unknown message type received.
     /// \throw isc::Unexpected if unexpected error occurred.
-    void processReceivedPacket6(const BetterSocket& socket,
+    void processReceivedPacket6(const PerfSocket& socket,
                                 const dhcp::Pkt6Ptr& pkt6);
 
     /// \brief Register option factory functions for DHCPv4
@@ -639,7 +639,7 @@ protected:
     /// \throw isc::Unexpected if failed to create new packet instance.
     /// \throw isc::BadValue if MAC address has invalid length.
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendDiscover4(const BetterSocket& socket,
+    void sendDiscover4(const PerfSocket& socket,
                        const bool preload = false);
 
     /// \brief Send DHCPv4 DISCOVER message from template.
@@ -657,7 +657,7 @@ protected:
     ///
     /// \throw isc::OutOfRange if randomization offset is out of bounds.
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendDiscover4(const BetterSocket& socket,
+    void sendDiscover4(const PerfSocket& socket,
                        const std::vector<uint8_t>& template_buf,
                        const bool preload = false);
 
@@ -682,7 +682,7 @@ protected:
     /// \throw isc::Unexpected if thrown by packet sending method.
     /// \throw isc::InvalidOperation if thrown by packet sending method.
     /// \throw isc::OutOfRange if thrown by packet sending method.
-    void sendPackets(const BetterSocket &socket,
+    void sendPackets(const PerfSocket &socket,
                      const uint64_t packets_num,
                      const bool preload = false);
 
@@ -692,7 +692,7 @@ protected:
     /// \param msg_num A number of messages to be sent.
     ///
     /// \return A number of messages actually sent.
-    uint64_t sendMultipleRequests(const BetterSocket& socket,
+    uint64_t sendMultipleRequests(const PerfSocket& socket,
                                   const uint64_t msg_num);
 
     /// \brief Send number of DHCPv6 Renew or Release messages to the server.
@@ -703,7 +703,7 @@ protected:
     /// \param msg_num A number of messages to be sent.
     ///
     /// \return A number of messages actually sent.
-    uint64_t sendMultipleMessages6(const BetterSocket& socket,
+    uint64_t sendMultipleMessages6(const PerfSocket& socket,
                                    const uint32_t msg_type,
                                    const uint64_t msg_num);
 
@@ -713,7 +713,7 @@ protected:
     /// a packet.
     ///
     /// \return true if the message has been sent, false otherwise.
-    bool sendRequestFromAck(const BetterSocket& socket);
+    bool sendRequestFromAck(const PerfSocket& socket);
 
     /// \brief Send DHCPv6 Renew or Release message using specified socket.
     ///
@@ -728,7 +728,7 @@ protected:
     ///
     /// \return true if the message has been sent, false otherwise.
     bool sendMessageFromReply(const uint16_t msg_type,
-                              const BetterSocket& socket);
+                              const PerfSocket& socket);
 
     /// \brief Send DHCPv4 REQUEST message.
     ///
@@ -744,7 +744,7 @@ protected:
     /// \throw isc::InvalidOperation if Statistics Manager has not been
     /// initialized.
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendRequest4(const BetterSocket& socket,
+    void sendRequest4(const PerfSocket& socket,
                       const dhcp::Pkt4Ptr& discover_pkt4,
                       const dhcp::Pkt4Ptr& offer_pkt4);
 
@@ -760,7 +760,7 @@ protected:
     /// \param offer_pkt4 OFFER packet received.
     ///
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendRequest4(const BetterSocket& socket,
+    void sendRequest4(const PerfSocket& socket,
                       const std::vector<uint8_t>& template_buf,
                       const dhcp::Pkt4Ptr& discover_pkt4,
                       const dhcp::Pkt4Ptr& offer_pkt4);
@@ -782,7 +782,7 @@ protected:
     /// initialized.
     ///
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendRequest6(const BetterSocket& socket,
+    void sendRequest6(const PerfSocket& socket,
                       const dhcp::Pkt6Ptr& advertise_pkt6);
 
     /// \brief Send DHCPv6 REQUEST message from template.
@@ -796,7 +796,7 @@ protected:
     /// \param advertise_pkt6 ADVERTISE packet object.
     ///
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendRequest6(const BetterSocket& socket,
+    void sendRequest6(const PerfSocket& socket,
                       const std::vector<uint8_t>& template_buf,
                       const dhcp::Pkt6Ptr& advertise_pkt6);
 
@@ -817,7 +817,7 @@ protected:
     ///
     /// \throw isc::Unexpected if failed to create new packet instance.
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendSolicit6(const BetterSocket& socket,
+    void sendSolicit6(const PerfSocket& socket,
                       const bool preload = false);
 
     /// \brief Send DHCPv6 SOLICIT message from template.
@@ -831,7 +831,7 @@ protected:
     /// \param preload mode, packets not included in statistics.
     ///
     /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
-    void sendSolicit6(const BetterSocket& socket,
+    void sendSolicit6(const PerfSocket& socket,
                       const std::vector<uint8_t>& template_buf,
                       const bool preload = false);
 
@@ -847,7 +847,7 @@ protected:
     ///
     /// \param socket socket used to send the packet.
     /// \param pkt reference to packet to be configured.
-    void setDefaults4(const BetterSocket& socket,
+    void setDefaults4(const PerfSocket& socket,
                       const dhcp::Pkt4Ptr& pkt);
 
     /// \brief Set default DHCPv6 packet parameters.
@@ -862,7 +862,7 @@ protected:
     ///
     /// \param socket socket used to send the packet.
     /// \param pkt reference to packet to be configured.
-    void setDefaults6(const BetterSocket& socket,
+    void setDefaults6(const PerfSocket& socket,
                       const dhcp::Pkt6Ptr& pkt);
 
     /// @brief Inserts extra options specified by user.
index 320371409ce53683f445994727c4606d2ec7fc74..0217b8e5426310fe1a9206006e572db4b19a16f6 100644 (file)
@@ -20,7 +20,7 @@ TEST(Receiver, singleThreaded) {
     CommandOptionsHelper::process("perfdhcp -g single -l 127.0.0.1 all");
     ASSERT_TRUE(CommandOptions::instance().isSingleThreaded());
 
-    BetterSocket sock(123);
+    PerfSocket sock(123);
 
     Receiver receiver(sock);
 
@@ -37,7 +37,7 @@ TEST(Receiver, multiThreaded) {
     CommandOptionsHelper::process("perfdhcp -g multi -l 127.0.0.1 all");
     ASSERT_FALSE(CommandOptions::instance().isSingleThreaded());
 
-    BetterSocket sock(123);
+    PerfSocket sock(123);
 
     Receiver receiver(sock);
 
index 7a253d564211a2b7d0f6ae02f9fd506f428715c5..fc9393bb5cb246ac7c6ded4908ceb990f0805762 100644 (file)
@@ -466,7 +466,7 @@ public:
         tc.setTransidGenerator(generator);
         // Socket is needed to send packets through the interface.
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
         for (int i = 0; i < iterations_num; ++i) {
             // Get next transaction id, without actually using it. The same
             // id wll be used by the TestControl class for DHCPDISCOVER.
@@ -531,7 +531,7 @@ public:
         tc.setTransidGenerator(generator);
         // Socket is needed to send packets through the interface.
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
         uint32_t transid = 0;
         for (int i = 0; i < iterations_num; ++i) {
             // Do not simulate responses for packets later
@@ -673,7 +673,7 @@ public:
         // Socket has to be created so as we can actually send packets.
         int sock_handle = 0;
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
 
         // Send a number of DHCPDISCOVER messages. Each generated message will
         // be assigned a different transaction id, starting from 1 to 10.
@@ -880,7 +880,7 @@ public:
         // Socket has to be created so as we can actually send packets.
         int sock_handle = 0;
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
 
         // Send a number of Solicit messages. Each generated Solicit will be
         // assigned a different transaction id, starting from 1 to 10.
@@ -1373,7 +1373,7 @@ TEST_F(TestControlTest, Packet4) {
         // We have to create the socket to setup some parameters of
         // outgoing packet.
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
         uint32_t transid = 123;
         boost::shared_ptr<Pkt4> pkt4(new Pkt4(DHCPDISCOVER, transid));
         // Set parameters on outgoing packet.
@@ -1406,7 +1406,7 @@ TEST_F(TestControlTest, Packet6) {
         // Create the socket. It will be needed to set packet's
         // parameters.
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
         uint32_t transid = 123;
         boost::shared_ptr<Pkt6> pkt6(new Pkt6(DHCPV6_SOLICIT, transid));
         // Set packet's parameters.
@@ -1439,7 +1439,7 @@ TEST_F(TestControlTest, Packet6Relayed) {
         // Create the socket. It will be needed to set packet's
         // parameters.
         ASSERT_NO_THROW(sock_handle = tc.openSocket());
-        BetterSocket sock(sock_handle);
+        PerfSocket sock(sock_handle);
         uint32_t transid = 123;
         boost::shared_ptr<Pkt6> pkt6(new Pkt6(DHCPV6_SOLICIT, transid));
         // Set packet's parameters.
@@ -1783,7 +1783,7 @@ TEST_F(TestControlTest, sendDiscoverExtraOpts) {
     // Socket is needed to send packets through the interface.
     int sock_handle = 0;
     ASSERT_NO_THROW(sock_handle = tc.openSocket());
-    BetterSocket sock(sock_handle);
+    PerfSocket sock(sock_handle);
 
     // Make tc send the packet. The first packet of each type is saved in templates.
     ASSERT_NO_THROW(tc.sendDiscover4(sock));