diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-06-14 22:40:01 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-06-14 22:40:01 +0000 |
commit | 9f4e1f6e097b3c97abe0971b68b2ab686a61f036 (patch) | |
tree | 00de3c2278a8f9792b28e522b4d56c03c5ab4d4e /src | |
parent | 29d417096f589276096c90e918b830439b6e14a2 (diff) | |
download | gnunet-9f4e1f6e097b3c97abe0971b68b2ab686a61f036.tar.gz gnunet-9f4e1f6e097b3c97abe0971b68b2ab686a61f036.zip |
- blacklist api calls, service side
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_new.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/mesh/gnunet-service-mesh_new.c b/src/mesh/gnunet-service-mesh_new.c index f70eb3bbf..0e35c907c 100644 --- a/src/mesh/gnunet-service-mesh_new.c +++ b/src/mesh/gnunet-service-mesh_new.c | |||
@@ -4245,7 +4245,6 @@ handle_local_blacklist (void *cls, struct GNUNET_SERVER_Client *client, | |||
4245 | const struct GNUNET_MessageHeader *message) | 4245 | const struct GNUNET_MessageHeader *message) |
4246 | { | 4246 | { |
4247 | struct GNUNET_MESH_PeerControl *peer_msg; | 4247 | struct GNUNET_MESH_PeerControl *peer_msg; |
4248 | |||
4249 | struct MeshClient *c; | 4248 | struct MeshClient *c; |
4250 | struct MeshTunnel *t; | 4249 | struct MeshTunnel *t; |
4251 | MESH_TunnelNumber tid; | 4250 | MESH_TunnelNumber tid; |
@@ -4279,7 +4278,8 @@ handle_local_blacklist (void *cls, struct GNUNET_SERVER_Client *client, | |||
4279 | } | 4278 | } |
4280 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on tunnel %X\n", t->id.tid); | 4279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on tunnel %X\n", t->id.tid); |
4281 | 4280 | ||
4282 | // GNUNET_array_append(t->blacklisted, t->nblacklisted, GNUNET_PEER_intern(peer)); | 4281 | GNUNET_array_append(t->blacklisted, t->nblacklisted, |
4282 | GNUNET_PEER_intern(&peer_msg->peer)); | ||
4283 | } | 4283 | } |
4284 | 4284 | ||
4285 | 4285 | ||
@@ -4298,8 +4298,8 @@ handle_local_unblacklist (void *cls, struct GNUNET_SERVER_Client *client, | |||
4298 | struct MeshClient *c; | 4298 | struct MeshClient *c; |
4299 | struct MeshTunnel *t; | 4299 | struct MeshTunnel *t; |
4300 | MESH_TunnelNumber tid; | 4300 | MESH_TunnelNumber tid; |
4301 | // GNUNET_PEER_Id pid; | 4301 | GNUNET_PEER_Id pid; |
4302 | // unsigned int i; | 4302 | unsigned int i; |
4303 | 4303 | ||
4304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a PEER UNBLACKLIST request\n"); | 4304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got a PEER UNBLACKLIST request\n"); |
4305 | /* Sanity check for client registration */ | 4305 | /* Sanity check for client registration */ |
@@ -4330,11 +4330,27 @@ handle_local_unblacklist (void *cls, struct GNUNET_SERVER_Client *client, | |||
4330 | } | 4330 | } |
4331 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on tunnel %X\n", t->id.tid); | 4331 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " on tunnel %X\n", t->id.tid); |
4332 | 4332 | ||
4333 | // pid = GNUNET_PEER_search (peer); | 4333 | /* if peer is not known, complain */ |
4334 | // for (i = 0; i < t->nblacklisted; i++) | 4334 | pid = GNUNET_PEER_search (&peer_msg->peer); |
4335 | // { | 4335 | if (0 == pid) |
4336 | // if (t->blacklisted[i] | 4336 | { |
4337 | // } | 4337 | GNUNET_break (0); |
4338 | return; | ||
4339 | } | ||
4340 | |||
4341 | /* search and remove from list */ | ||
4342 | for (i = 0; i < t->nblacklisted; i++) | ||
4343 | { | ||
4344 | if (t->blacklisted[i] == pid) | ||
4345 | { | ||
4346 | t->blacklisted[i] = t->blacklisted[t->nblacklisted - 1]; | ||
4347 | GNUNET_array_grow (t->blacklisted, t->nblacklisted, t->nblacklisted - 1); | ||
4348 | return; | ||
4349 | } | ||
4350 | } | ||
4351 | |||
4352 | /* if peer hasn't been blacklisted, complain */ | ||
4353 | GNUNET_break (0); | ||
4338 | } | 4354 | } |
4339 | 4355 | ||
4340 | 4356 | ||