c = clients_head;
while(NULL != c) {
if(c->handle == client) return c;
- if(c == clients_tail)
- return NULL;
- else
- c = c->next;
+ c = c->next;
}
return NULL;
}
if(p->peers[p->length-1] == peer_info->id) {
break;
}
- if(p != peer_info->t->paths_tail) {
- p = p->next;
- } else {
- // TODO ERROR Path not found
- }
+ p = p->next;
}
+ if(p == NULL) return 0; // TODO Notify ERROR Path not found
size_needed = sizeof(struct GNUNET_MESH_ManipulatePath)
+ p->length * sizeof(struct GNUNET_PeerIdentity);
} else {
c = c->next;
}
- if(c == clients_head) return; /* Tail already processed? */
}
return;
}
GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
return;
}
- if(t == c->tunnels_tail) break;
t = t->next;
}
/* FIXME: calloc? Is NULL != 0 on any platform? */
/* Tunnel exists? */
tid = ntohl(peer_msg->tunnel_id);
- if(NULL == (t = c->tunnels_head)) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
+ t = c->tunnels_head;
while(NULL != t) {
if(t->tid == tid) {
break;
}
- if(t == c->tunnels_tail) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
t = t->next;
}
+ if(NULL == t) {
+ GNUNET_break(0);
+ GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
+ return;
+ }
/* Does client own tunnel? */
if(t->client->handle != client) {
}
t = t->next;
}
+ if(NULL == t) {
+ GNUNET_break(0);
+ GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
+ return;
+ }
/* Does client own tunnel? */
if(t->client->handle != client) {
} else {
p = p->next;
}
- if(p == t->paths_head) {
- break;
- }
}
/*Delete peer info */
} else {
peer_info = peer_info->next;
}
- if(peer_info == t->peers_head) {
- break;
- }
}
GNUNET_PEER_change_rc(peer_id, -1);
/* Tunnel exists? */
tid = ntohl(connect_msg->tunnel_id);
- if(NULL == (t = c->tunnels_head)) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
+ t = c->tunnels_head;
while(NULL != t) {
if(t->tid == tid) {
break;
}
- if(t == c->tunnels_tail) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
t = t->next;
}
+ if(NULL == t) {
+ GNUNET_break(0);
+ GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
+ return;
+ }
/* Does client own tunnel? */
if(t->client->handle != client) {
/* Tunnel exists? */
tid = ntohl(data_msg->tunnel_id);
- if(NULL == (t = c->tunnels_head)) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
+ t = c->tunnels_head;
while(NULL != t) {
if(t->tid == tid) {
break;
}
- if(t == c->tunnels_tail) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
t = t->next;
}
+ if(NULL == t) {
+ GNUNET_break(0);
+ GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
+ return;
+ }
/* Does client own tunnel? */
if(t->client->handle != client) {
/* Tunnel exists? */
tid = ntohl(data_msg->tunnel_id);
- if(NULL == (t = c->tunnels_head)) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
+ t = c->tunnels_head;
while(NULL != t) {
if(t->tid == tid) {
break;
}
- if(t == c->tunnels_tail) {
- GNUNET_break(0);
- GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
- return;
- }
t = t->next;
}
+ if(NULL == t) {
+ GNUNET_break(0);
+ GNUNET_SERVER_receive_done(client, GNUNET_SYSERR);
+ return;
+ }
/* Does client own tunnel? */
if(t->client->handle != client) {