refactor in progress

This commit is contained in:
Joseph Henry
2015-09-10 18:48:45 -04:00
parent e391bc004b
commit b11d429bc0
3 changed files with 33 additions and 65 deletions

View File

@@ -63,19 +63,19 @@ namespace ZeroTier {
//
class NetconClient
{
private:
public:
vector<NetconConnection*> connections;
public:
int tid;
bool waiting_for_retval;
NetconConnection *rpc;
NetconConnection* unmapped_conn;
void addConnection(NetconConnectionType type, PhySocket *sock)
NetconConnection *addConnection(NetconConnectionType type, PhySocket *sock)
{
NetconConnection *new_conn = new NetconConnection(type, sock);
new_conn->owner = this;
return new_conn;
}
// Check data and RPC connections
@@ -84,7 +84,7 @@ namespace ZeroTier {
if(sock && sock == rpc->sock) {
return rpc;
}
for(int i=0; i<connections.size(); i++) {
for(size_t i=0; i<connections.size(); i++) {
if(sock == connections[i]->sock) { return connections[i];}
}
return NULL;
@@ -93,7 +93,7 @@ namespace ZeroTier {
//
NetconConnection *getConnectionByTheirFD(int fd)
{
for(int i=0; i<connections.size(); i++) {
for(size_t i=0; i<connections.size(); i++) {
if(connections[i]->their_fd == fd) { return connections[i]; }
}
return NULL;
@@ -102,7 +102,7 @@ namespace ZeroTier {
//
NetconConnection *getConnectionByPCB(struct tcp_pcb *pcb)
{
for(int i=0; i<connections.size(); i++) {
for(size_t i=0; i<connections.size(); i++) {
if(connections[i]->pcb = pcb) { return connections[i]; }
}
return NULL;
@@ -110,7 +110,7 @@ namespace ZeroTier {
NetconConnection *containsPCB(struct tcp_pcb *pcb)
{
for(int i=0; i<connections.size(); i++) {
for(size_t i=0; i<connections.size(); i++) {
if(connections[i]->pcb = pcb) { return connections[i]; }
}
return NULL;