Fixed their_fd closure bug
This commit is contained in:
parent
1119f64a77
commit
8a8264bc39
2 changed files with 8 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue