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

View file

@ -566,7 +566,7 @@ public:
try { try {
while (!_tcpConnections.empty()) while (!_tcpConnections.empty())
_phy.close(_tcpConnections.begin()->first); _phy.close((*_tcpConnections.begin())->sock);
} catch ( ... ) {} } catch ( ... ) {}
{ {
@ -651,7 +651,9 @@ public:
// Outgoing TCP connections are always TCP fallback tunnel connections. // 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->type = TcpConnection::TCP_TUNNEL_OUTGOING;
tc->shouldKeepAlive = true; tc->shouldKeepAlive = true;
tc->parent = this; tc->parent = this;
@ -682,7 +684,9 @@ public:
{ {
// Incoming TCP connections are HTTP JSON API requests. // 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->type = TcpConnection::TCP_HTTP_INCOMING;
tc->shouldKeepAlive = true; tc->shouldKeepAlive = true;
tc->parent = this; tc->parent = this;
@ -704,11 +708,12 @@ public:
inline void phyOnTcpClose(PhySocket *sock,void **uptr) inline void phyOnTcpClose(PhySocket *sock,void **uptr)
{ {
std::map< PhySocket *,TcpConnection >::iterator tc(_tcpConnections.find(sock)); TcpConnection *tc = (TcpConnection *)*uptr;
if (tc != _tcpConnections.end()) { if (tc) {
if (&(tc->second) == _tcpFallbackTunnel) if (tc == _tcpFallbackTunnel)
_tcpFallbackTunnel = (TcpConnection *)0; _tcpFallbackTunnel = (TcpConnection *)0;
_tcpConnections.erase(tc); _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 std::map< uint64_t,std::vector<InetAddress> > _tapAssignedIps; // ZeroTier assigned IPs, not user or dhcp assigned
Mutex _taps_m; 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; TcpConnection *_tcpFallbackTunnel;
ReasonForTermination _termReason; ReasonForTermination _termReason;