Fixed their_fd closure bug
This commit is contained in:
@@ -66,6 +66,7 @@ namespace ZeroTier {
|
||||
class NetconConnection
|
||||
{
|
||||
public:
|
||||
int perceived_fd;
|
||||
int their_fd;
|
||||
unsigned char buf[DEFAULT_READ_BUFFER_SIZE];
|
||||
int idx;
|
||||
@@ -113,7 +114,7 @@ namespace ZeroTier {
|
||||
NetconConnection *getConnectionByTheirFD(int fd)
|
||||
{
|
||||
for(size_t i=0; i<connections.size(); i++) {
|
||||
if(connections[i]->their_fd == fd) return connections[i];
|
||||
if(connections[i]->perceived_fd == fd) return connections[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -134,14 +135,6 @@ namespace ZeroTier {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void removeConnection(PhySocket *sock)
|
||||
{
|
||||
for(size_t i=0; i<connections.size(); i++) {
|
||||
if(connections[i]->sock == sock)
|
||||
connections.erase(connections.begin() + i);
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace ZeroTier
|
||||
|
||||
|
||||
Reference in New Issue
Block a user