Build fix.

This commit is contained in:
Adam Ierymenko 2015-05-22 15:46:06 -07:00
parent 6867922d9e
commit d8783b14eb
2 changed files with 14 additions and 9 deletions

View File

@ -454,7 +454,7 @@ unsigned long Switch::doTimerTasks(uint64_t now)
if (p < 0xffff) {
tmpaddr.setPort((unsigned int)p);
qi->peer->attemptToContactAt(RR,tmpaddr,now);
}
} else qi->strategyIteration = 9;
} else if (qi->strategyIteration <= 18) {
// Strategies 10-18: try ports below
InetAddress tmpaddr(qi->inaddr);
@ -462,7 +462,7 @@ unsigned long Switch::doTimerTasks(uint64_t now)
if (p >= 1024) {
tmpaddr.setPort((unsigned int)p);
qi->peer->attemptToContactAt(RR,tmpaddr,now);
}
} else qi->strategyIteration = 18;
} else {
// All strategies tried, expire entry
_contactQueue.erase(qi++);

View File

@ -566,7 +566,7 @@ public:
try {
while (!_tcpConnections.empty())
_phy.close(_tcpConnections.begin()->first);
_phy.close((*_tcpConnections.begin())->sock);
} catch ( ... ) {}
{
@ -651,7 +651,9 @@ public:
// Outgoing TCP connections are always TCP fallback tunnel connections.
TcpConnection *tc = &(_tcpConnections[sock]);
TcpConnection *tc = new TcpConnection();
_tcpConnections.insert(tc);
tc->type = TcpConnection::TCP_TUNNEL_OUTGOING;
tc->shouldKeepAlive = true;
tc->parent = this;
@ -682,7 +684,9 @@ public:
{
// Incoming TCP connections are HTTP JSON API requests.
TcpConnection *tc = &(_tcpConnections[sockN]);
TcpConnection *tc = new TcpConnection();
_tcpConnections.insert(tc);
tc->type = TcpConnection::TCP_HTTP_INCOMING;
tc->shouldKeepAlive = true;
tc->parent = this;
@ -704,11 +708,12 @@ public:
inline void phyOnTcpClose(PhySocket *sock,void **uptr)
{
std::map< PhySocket *,TcpConnection >::iterator tc(_tcpConnections.find(sock));
if (tc != _tcpConnections.end()) {
if (&(tc->second) == _tcpFallbackTunnel)
TcpConnection *tc = (TcpConnection *)*uptr;
if (tc) {
if (tc == _tcpFallbackTunnel)
_tcpFallbackTunnel = (TcpConnection *)0;
_tcpConnections.erase(tc);
delete tc;
}
}
@ -1142,7 +1147,7 @@ private:
std::map< uint64_t,std::vector<InetAddress> > _tapAssignedIps; // ZeroTier assigned IPs, not user or dhcp assigned
Mutex _taps_m;
std::map< PhySocket *,TcpConnection > _tcpConnections; // no mutex for this since it's done in the main loop thread only
std::set< TcpConnection * > _tcpConnections; // no mutex for this since it's done in the main loop thread only
TcpConnection *_tcpFallbackTunnel;
ReasonForTermination _termReason;