]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: C++11 default initializers for Comm::Connection (#2147)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sat, 30 Aug 2025 05:26:44 +0000 (05:26 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Sat, 30 Aug 2025 17:14:55 +0000 (05:14 +1200)
src/comm/Connection.cc
src/comm/Connection.h
src/tests/stub_libcomm.cc

index e63a5b6d05e340fa48511e4bf623347167e3b260..181661b41babf519e34870777f01b9537c94b975 100644 (file)
@@ -29,17 +29,6 @@ Comm::IsConnOpen(const Comm::ConnectionPointer &conn)
     return conn != nullptr && conn->isOpen();
 }
 
-Comm::Connection::Connection() :
-    peerType(HIER_NONE),
-    fd(-1),
-    tos(0),
-    nfmark(0),
-    flags(COMM_NONBLOCKING),
-    peer_(nullptr),
-    startTime_(squid_curtime),
-    tlsHistory(nullptr)
-{}
-
 Comm::Connection::~Connection()
 {
     if (fd >= 0) {
index a8f1f970c3b8ec6b3fcfa3a3d5fb57b94f131f6e..efe3db5ac610331b7460452b0f32b505464f8006 100644 (file)
@@ -74,7 +74,7 @@ class Connection: public CodeContext
     MEMPROXY_CLASS(Comm::Connection);
 
 public:
-    Connection();
+    Connection() { noteStart(); }
 
     /** Clear the connection properties and close any open socket. */
     ~Connection() override;
@@ -149,18 +149,18 @@ public:
     Ip::Address remote;
 
     /** Hierarchy code for this connection link */
-    hier_code peerType;
+    hier_code peerType = HIER_NONE;
 
     /** Socket used by this connection. Negative if not open. */
-    int fd;
+    int fd = -1;
 
     /** Quality of Service TOS values currently sent on this connection */
-    tos_t tos;
+    tos_t tos = 0;
 
     /** Netfilter MARK values currently sent on this connection
      * In case of FTP, the MARK will be sent on data connections as well.
      */
-    nfmark_t nfmark;
+    nfmark_t nfmark = 0;
 
     /** Netfilter CONNMARK value previously retrieved from this connection
      * In case of FTP, the CONNMARK will NOT be applied to data connections, for one main reason:
@@ -171,7 +171,7 @@ public:
     nfmark_t nfConnmark = 0;
 
     /** COMM flags set on this connection */
-    int flags;
+    int flags = COMM_NONBLOCKING;
 
 #if USE_SQUID_EUI
     Eui::Eui48 remoteEui48;
@@ -182,13 +182,13 @@ public:
 
 private:
     /** cache_peer data object (if any) */
-    CachePeer *peer_;
+    CachePeer *peer_ = nullptr;
 
     /** The time the connection object was created */
     time_t startTime_;
 
     /** TLS connection details*/
-    Security::NegotiationHistory *tlsHistory;
+    Security::NegotiationHistory *tlsHistory = nullptr;
 };
 
 std::ostream &operator <<(std::ostream &, const Connection &);
index e71ce241e18e59f6fb80857174dd6d151c731b6c..d16a789c59c3185ed4bac54fc4204583a1762387 100644 (file)
@@ -20,7 +20,6 @@ void Comm::AcceptLimiter::removeDead(const Comm::TcpAcceptor::Pointer &) STUB
 void Comm::AcceptLimiter::kick() STUB
 
 #include "comm/Connection.h"
-Comm::Connection::Connection() STUB
 Comm::Connection::~Connection() STUB
 Comm::ConnectionPointer Comm::Connection::cloneProfile() const STUB_RETVAL(nullptr)
 void Comm::Connection::close() STUB