aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed_oc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-service-testbed_oc.c')
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index 4fe7c20b3..b13a3b7e0 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -685,15 +685,14 @@ overlay_connect_notify (void *cls,
685 685
686 LOG_DEBUG ("Overlay connect notify\n"); 686 LOG_DEBUG ("Overlay connect notify\n");
687 if (0 == 687 if (0 ==
688 memcmp (new_peer, &occ->peer_identity, 688 GNUNET_memcmp (new_peer,
689 sizeof(struct GNUNET_PeerIdentity))) 689 &occ->peer_identity))
690 return; 690 return;
691 new_peer_str = GNUNET_strdup (GNUNET_i2s (new_peer)); 691 new_peer_str = GNUNET_strdup (GNUNET_i2s (new_peer));
692 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); 692 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
693 if (0 != 693 if (0 !=
694 memcmp (new_peer, 694 GNUNET_memcmp (new_peer,
695 &occ->other_peer_identity, 695 &occ->other_peer_identity))
696 sizeof(struct GNUNET_PeerIdentity)))
697 { 696 {
698 LOG_DEBUG ("Unexpected peer %s connected when expecting peer %s\n", 697 LOG_DEBUG ("Unexpected peer %s connected when expecting peer %s\n",
699 new_peer_str, 698 new_peer_str,
@@ -1180,19 +1179,23 @@ occ_cache_get_handle_core_cb (void *cls,
1180 return; 1179 return;
1181 } 1180 }
1182 occ->emsg = NULL; 1181 occ->emsg = NULL;
1182 occ->peer_identity = *my_identity;
1183 if (NULL != 1183 if (NULL !=
1184 GNUNET_CORE_get_mq (ch, 1184 GNUNET_CORE_get_mq (ch,
1185 &occ->other_peer_identity)) 1185 &occ->other_peer_identity))
1186 { 1186 {
1187 LOG_DEBUG ("0x%llx: Target peer already connected\n", 1187 LOG_DEBUG ("0x%llx: Target peer %s already connected\n",
1188 (unsigned long long) occ->op_id); 1188 (unsigned long long) occ->op_id,
1189 GNUNET_i2s (&occ->other_peer_identity));
1190 LOG_DEBUG ("0x%llx: Target peer %s connected\n",
1191 (unsigned long long) occ->op_id,
1192 GNUNET_i2s (&occ->peer_identity));
1189 GNUNET_SCHEDULER_cancel (occ->timeout_task); 1193 GNUNET_SCHEDULER_cancel (occ->timeout_task);
1190 occ->timeout_task = NULL; 1194 occ->timeout_task = NULL;
1191 send_overlay_connect_success_msg (occ); 1195 send_overlay_connect_success_msg (occ);
1192 occ->cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup_occ, occ); 1196 occ->cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup_occ, occ);
1193 return; 1197 return;
1194 } 1198 }
1195 occ->peer_identity = *my_identity;
1196 LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", 1199 LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n",
1197 (unsigned long long) occ->op_id, 1200 (unsigned long long) occ->op_id,
1198 GNUNET_i2s (&occ->peer_identity)); 1201 GNUNET_i2s (&occ->peer_identity));
@@ -1259,12 +1262,11 @@ overlay_connect_get_config (void *cls,
1259 GST_connection_pool_get_handle (occ->peer->id, 1262 GST_connection_pool_get_handle (occ->peer->id,
1260 occ->peer->details.local.cfg, 1263 occ->peer->details.local.cfg,
1261 GST_CONNECTIONPOOL_SERVICE_CORE, 1264 GST_CONNECTIONPOOL_SERVICE_CORE,
1262 occ_cache_get_handle_core_cb, 1265 &occ_cache_get_handle_core_cb,
1263 occ, 1266 occ,
1264 &occ->other_peer_identity, 1267 &occ->other_peer_identity,
1265 &overlay_connect_notify, 1268 &overlay_connect_notify,
1266 occ); 1269 occ);
1267 return;
1268} 1270}
1269 1271
1270 1272
@@ -1540,6 +1542,12 @@ handle_overlay_connect (void *cls,
1540 1542
1541 p1 = ntohl (msg->peer1); 1543 p1 = ntohl (msg->peer1);
1542 p2 = ntohl (msg->peer2); 1544 p2 = ntohl (msg->peer2);
1545 if (p1 == p2)
1546 {
1547 GNUNET_break (0);
1548 GNUNET_SERVICE_client_drop (client);
1549 return;
1550 }
1543 if (! VALID_PEER_ID (p1)) 1551 if (! VALID_PEER_ID (p1))
1544 { 1552 {
1545 GNUNET_break (0); 1553 GNUNET_break (0);
@@ -1620,12 +1628,10 @@ handle_overlay_connect (void *cls,
1620 &p2_controller_connect_cb, 1628 &p2_controller_connect_cb,
1621 occ); 1629 occ);
1622 break; 1630 break;
1623
1624 case OCC_TYPE_REMOTE_SLAVE: 1631 case OCC_TYPE_REMOTE_SLAVE:
1625 p2_controller_connect_cb (occ, 1632 p2_controller_connect_cb (occ,
1626 occ->p2ctx.remote.p2c); 1633 occ->p2ctx.remote.p2c);
1627 break; 1634 break;
1628
1629 case OCC_TYPE_LOCAL: 1635 case OCC_TYPE_LOCAL:
1630 peer2 = GST_peer_list[occ->other_peer_id]; 1636 peer2 = GST_peer_list[occ->other_peer_id];
1631 peer2->reference_cnt++; 1637 peer2->reference_cnt++;
@@ -1636,11 +1642,23 @@ handle_overlay_connect (void *cls,
1636 "id: %u", 1642 "id: %u",
1637 (unsigned long long) occ->op_id, 1643 (unsigned long long) occ->op_id,
1638 occ->peer->id); 1644 occ->peer->id);
1645 LOG_DEBUG ("Peer %u has PID %s\n",
1646 occ->other_peer_id,
1647 GNUNET_i2s (&occ->other_peer_identity));
1648 {
1649 struct GNUNET_PeerIdentity lpid;
1650
1651 GNUNET_TESTING_peer_get_identity (peer->details.local.peer,
1652 &lpid);
1653 LOG_DEBUG ("Peer %u has PID %s\n",
1654 p1,
1655 GNUNET_i2s (&lpid));
1656 }
1639 occ->cgh_ch = 1657 occ->cgh_ch =
1640 GST_connection_pool_get_handle (occ->peer->id, 1658 GST_connection_pool_get_handle (occ->peer->id,
1641 occ->peer->details.local.cfg, 1659 occ->peer->details.local.cfg,
1642 GST_CONNECTIONPOOL_SERVICE_CORE, 1660 GST_CONNECTIONPOOL_SERVICE_CORE,
1643 occ_cache_get_handle_core_cb, occ, 1661 &occ_cache_get_handle_core_cb, occ,
1644 &occ->other_peer_identity, 1662 &occ->other_peer_identity,
1645 &overlay_connect_notify, occ); 1663 &overlay_connect_notify, occ);
1646 break; 1664 break;