aboutsummaryrefslogtreecommitdiff
path: root/src/rps
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2016-09-06 11:42:35 +0000
committerJulius Bünger <buenger@mytum.de>2016-09-06 11:42:35 +0000
commit0aa6aba60fe03d8cb293d7f0db53ce044b45ad0a (patch)
tree123c1dd934c0f53a2b0fac13772279492cab3d01 /src/rps
parent4b93349e9dcf5eba94944650d5a78370fd5c2f9b (diff)
downloadgnunet-0aa6aba60fe03d8cb293d7f0db53ce044b45ad0a.tar.gz
gnunet-0aa6aba60fe03d8cb293d7f0db53ce044b45ad0a.zip
-rps service: improved handling of errors
Diffstat (limited to 'src/rps')
-rw-r--r--src/rps/gnunet-service-rps.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 302e0d39b..021d360ca 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -1143,9 +1143,10 @@ handle_client_seed (void *cls,
1143 1143
1144 if (sizeof (struct GNUNET_RPS_CS_SeedMessage) > ntohs (message->size)) 1144 if (sizeof (struct GNUNET_RPS_CS_SeedMessage) > ntohs (message->size))
1145 { 1145 {
1146 GNUNET_break_op (0);
1147 GNUNET_SERVER_receive_done (client, 1146 GNUNET_SERVER_receive_done (client,
1148 GNUNET_SYSERR); 1147 GNUNET_SYSERR);
1148 GNUNET_break_op (0);
1149 return;
1149 } 1150 }
1150 1151
1151 in_msg = (struct GNUNET_RPS_CS_SeedMessage *) message; 1152 in_msg = (struct GNUNET_RPS_CS_SeedMessage *) message;
@@ -1254,12 +1255,14 @@ handle_peer_push (void *cls,
1254 tmp_att_peer); 1255 tmp_att_peer);
1255 add_peer_array_to_set (peer, 1, att_peer_set); 1256 add_peer_array_to_set (peer, 1, att_peer_set);
1256 } 1257 }
1258 GNUNET_CADET_receive_done (channel);
1257 return GNUNET_OK; 1259 return GNUNET_OK;
1258 } 1260 }
1259 1261
1260 1262
1261 else if (2 == mal_type) 1263 else if (2 == mal_type)
1262 { /* We attack one single well-known peer - simply ignore */ 1264 { /* We attack one single well-known peer - simply ignore */
1265 GNUNET_CADET_receive_done (channel);
1263 return GNUNET_OK; 1266 return GNUNET_OK;
1264 } 1267 }
1265 else 1268 else
@@ -1308,6 +1311,7 @@ handle_peer_pull_request (void *cls,
1308 || 3 == mal_type) 1311 || 3 == mal_type)
1309 { /* Try to maximise representation */ 1312 { /* Try to maximise representation */
1310 send_pull_reply (peer, mal_peers, num_mal_peers); 1313 send_pull_reply (peer, mal_peers, num_mal_peers);
1314 GNUNET_CADET_receive_done (channel);
1311 return GNUNET_OK; 1315 return GNUNET_OK;
1312 } 1316 }
1313 1317
@@ -1317,6 +1321,7 @@ handle_peer_pull_request (void *cls,
1317 { 1321 {
1318 send_pull_reply (peer, mal_peers, num_mal_peers); 1322 send_pull_reply (peer, mal_peers, num_mal_peers);
1319 } 1323 }
1324 GNUNET_CADET_receive_done (channel);
1320 return GNUNET_OK; 1325 return GNUNET_OK;
1321 } 1326 }
1322 #endif /* ENABLE_MALICIOUS */ 1327 #endif /* ENABLE_MALICIOUS */
@@ -1388,8 +1393,8 @@ handle_peer_pull_reply (void *cls,
1388 { 1393 {
1389 LOG (GNUNET_ERROR_TYPE_WARNING, 1394 LOG (GNUNET_ERROR_TYPE_WARNING,
1390 "Received a pull reply from a peer we didn't request one from!\n"); 1395 "Received a pull reply from a peer we didn't request one from!\n");
1391 GNUNET_break_op (0);
1392 GNUNET_CADET_receive_done (channel); 1396 GNUNET_CADET_receive_done (channel);
1397 GNUNET_break_op (0);
1393 return GNUNET_OK; 1398 return GNUNET_OK;
1394 } 1399 }
1395 1400
@@ -1397,7 +1402,10 @@ handle_peer_pull_reply (void *cls,
1397 #ifdef ENABLE_MALICIOUS 1402 #ifdef ENABLE_MALICIOUS
1398 // We shouldn't even receive pull replies as we're not sending 1403 // We shouldn't even receive pull replies as we're not sending
1399 if (2 == mal_type) 1404 if (2 == mal_type)
1405 {
1406 GNUNET_CADET_receive_done (channel);
1400 return GNUNET_OK; 1407 return GNUNET_OK;
1408 }
1401 #endif /* ENABLE_MALICIOUS */ 1409 #endif /* ENABLE_MALICIOUS */
1402 1410
1403 /* Do actual logic */ 1411 /* Do actual logic */
@@ -1579,6 +1587,7 @@ handle_client_act_malicious (void *cls,
1579 /* Check for protocol violation */ 1587 /* Check for protocol violation */
1580 if (sizeof (struct GNUNET_RPS_CS_ActMaliciousMessage) > ntohs (msg->size)) 1588 if (sizeof (struct GNUNET_RPS_CS_ActMaliciousMessage) > ntohs (msg->size))
1581 { 1589 {
1590 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1582 GNUNET_break_op (0); 1591 GNUNET_break_op (0);
1583 } 1592 }
1584 1593
@@ -1591,6 +1600,7 @@ handle_client_act_malicious (void *cls,
1591 ntohl (in_msg->num_peers), 1600 ntohl (in_msg->num_peers),
1592 (ntohs (msg->size) - sizeof (struct GNUNET_RPS_CS_ActMaliciousMessage)) / 1601 (ntohs (msg->size) - sizeof (struct GNUNET_RPS_CS_ActMaliciousMessage)) /
1593 sizeof (struct GNUNET_PeerIdentity)); 1602 sizeof (struct GNUNET_PeerIdentity));
1603 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1594 GNUNET_break_op (0); 1604 GNUNET_break_op (0);
1595 } 1605 }
1596 1606
@@ -1681,9 +1691,9 @@ handle_client_act_malicious (void *cls,
1681 else 1691 else
1682 { 1692 {
1683 GNUNET_break (0); 1693 GNUNET_break (0);
1694 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1684 } 1695 }
1685 GNUNET_SERVER_receive_done (client, 1696 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1686 GNUNET_OK);
1687} 1697}
1688 1698
1689 1699