/*
- * DEBUG: section 05 Socket Connection Opener
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
+/* DEBUG: section 05 Socket Connection Opener */
+
#include "squid.h"
#include "CachePeer.h"
#include "comm.h"
CBDATA_NAMESPACED_CLASS_INIT(Comm, ConnOpener);
-Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &c, AsyncCall::Pointer &handler, time_t ctimeout) :
- AsyncJob("Comm::ConnOpener"),
- host_(NULL),
- temporaryFd_(-1),
- conn_(c),
- callback_(handler),
- totalTries_(0),
- failRetries_(0),
- deadline_(squid_curtime + static_cast<time_t>(ctimeout))
-{}
+Comm::ConnOpener::ConnOpener(const Comm::ConnectionPointer &c, const AsyncCall::Pointer &handler, time_t ctimeout) :
+ AsyncJob("Comm::ConnOpener"),
+ host_(NULL),
+ temporaryFd_(-1),
+ conn_(c),
+ callback_(handler),
+ totalTries_(0),
+ failRetries_(0),
+ deadline_(squid_curtime + static_cast<time_t>(ctimeout))
+{
+ debugs(5, 3, "will connect to " << c << " with " << ctimeout << " timeout");
+}
Comm::ConnOpener::~ConnOpener()
{
{
Must(temporaryFd_ < 0);
- // our initators signal abort by cancelling their callbacks
+ // our initiators signal abort by cancelling their callbacks
if (callback_ == NULL || callback_->canceled())
return false;
Comm::ConnOpener::lookupLocalAddress()
{
struct addrinfo *addr = NULL;
- Ip::Address::InitAddrInfo(addr);
+ Ip::Address::InitAddr(addr);
if (getsockname(conn_->fd, addr->ai_addr, &(addr->ai_addrlen)) != 0) {
- debugs(50, DBG_IMPORTANT, "ERROR: Failed to retrieve TCP/UDP details for socket: " << conn_ << ": " << xstrerror());
- Ip::Address::FreeAddrInfo(addr);
+ int xerrno = errno;
+ debugs(50, DBG_IMPORTANT, "ERROR: Failed to retrieve TCP/UDP details for socket: " << conn_ << ": " << xstrerr(xerrno));
+ Ip::Address::FreeAddr(addr);
return;
}
conn_->local = *addr;
- Ip::Address::FreeAddrInfo(addr);
+ Ip::Address::FreeAddr(addr);
debugs(5, 6, HERE << conn_);
}
* XXX: As soon as Comm::SetSelect() accepts Async calls we can use a ConnOpener::doConnect call
*/
void
-Comm::ConnOpener::InProgressConnectRetry(int fd, void *data)
+Comm::ConnOpener::InProgressConnectRetry(int, void *data)
{
Pointer *ptr = static_cast<Pointer*>(data);
assert(ptr);
}
delete ptr;
}
+