summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-22 15:46:06 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-22 15:46:06 -0700
commitd8783b14eb465cd97950afd726e940bbe3708c8a (patch)
treeaf62170c9e63b68bea404403183613af17cdf865 /service
parent6867922d9e33cd6091a86cae6d013a7bbbd125a6 (diff)
downloadinfinitytier-d8783b14eb465cd97950afd726e940bbe3708c8a.tar.gz
infinitytier-d8783b14eb465cd97950afd726e940bbe3708c8a.zip
Build fix.
Diffstat (limited to 'service')
-rw-r--r--service/OneService.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 797825a7..9a72c240 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -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;