{
ConnectionPointer c = new Comm::Connection;
- c->local = local;
- c->remote = remote;
+ c->setAddrs(local, remote);
c->peerType = peerType;
c->tos = tos;
c->nfmark = nfmark;
/** determine whether this object describes an active connection or not. */
bool isOpen() const { return (fd >= 0); }
+ /** Alter the stored IP address pair.
+ * WARNING: Does not ensure matching IPv4/IPv6 are supplied.
+ */
+ void setAddrs(const Ip::Address &aLocal, const Ip::Address &aRemote) {local = aLocal; remote = aRemote;}
+
/** retrieve the CachePeer pointer for use.
* The caller is responsible for all CBDATA operations regarding the
* used of the pointer returned.
Comm::ConnectionPointer conn = new Comm::Connection();
if (!Config.Addrs.udp_outgoing.isNoAddr())
- conn->local = Config.Addrs.udp_outgoing;
+ conn->setAddrs(Config.Addrs.udp_outgoing, nameservers[nsv].S);
else
- conn->local = Config.Addrs.udp_incoming;
+ conn->setAddrs(Config.Addrs.udp_incoming, nameservers[nsv].S);
- conn->remote = nameservers[nsv].S;
-
- if (conn->remote.isIPv4()) {
+ if (conn->remote.isIPv4())
conn->local.setIPv4();
- }
AsyncCall::Pointer call = commCbCall(78,3, "idnsInitVCConnected", CommConnectCbPtrFun(idnsInitVCConnected, vc));
// Generate a new data channel descriptor to be opened.
Comm::ConnectionPointer conn = new Comm::Connection;
- conn->local = ftpState->ctrl.conn->local;
+ conn->setAddrs(ftpState->ctrl.conn->local, ftpState->ctrl.conn->remote);
conn->local.port(0);
- conn->remote = ftpState->ctrl.conn->remote;
conn->remote.port(port);
conn->tos = ftpState->ctrl.conn->tos;
conn->nfmark = ftpState->ctrl.conn->nfmark;
ftpState->ctrl.last_command = xstrdup("Connect to server data port");
Comm::ConnectionPointer conn = new Comm::Connection;
- conn->local = ftpState->ctrl.conn->local;
+ conn->setAddrs(ftpState->ctrl.conn->local, ipaddr);
conn->local.port(0);
- conn->remote = ipaddr;
conn->remote.port(port);
debugs(9, 3, HERE << "connecting to " << conn->remote);