diff options
Diffstat (limited to 'src/testbed/gnunet-service-testbed_oc.c')
-rw-r--r-- | src/testbed/gnunet-service-testbed_oc.c | 180 |
1 files changed, 118 insertions, 62 deletions
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index 1d57499f7..bb3a04e93 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c | |||
@@ -65,7 +65,7 @@ struct TryConnectContext | |||
65 | /** | 65 | /** |
66 | * The task handle | 66 | * The task handle |
67 | */ | 67 | */ |
68 | struct GNUNET_SCHEDULER_Task * task; | 68 | struct GNUNET_SCHEDULER_Task *task; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * The id of the operation which is resposible for this context | 71 | * The id of the operation which is resposible for this context |
@@ -131,7 +131,7 @@ struct LocalPeer2Context | |||
131 | struct RemotePeer2Context | 131 | struct RemotePeer2Context |
132 | { | 132 | { |
133 | /** | 133 | /** |
134 | * Controller of peer 2; If OCC_TYPE_REMOTE_LATERAL is the type of overlay | 134 | * Controller of peer 2; If #OCC_TYPE_REMOTE_LATERAL is the type of overlay |
135 | * connection then this can be NULL until the connection to the controller is | 135 | * connection then this can be NULL until the connection to the controller is |
136 | * established | 136 | * established |
137 | */ | 137 | */ |
@@ -145,7 +145,7 @@ struct RemotePeer2Context | |||
145 | 145 | ||
146 | /** | 146 | /** |
147 | * Notification handle acquire to connect to a remote controller. Only used | 147 | * Notification handle acquire to connect to a remote controller. Only used |
148 | * if the type of overlay connection is OCC_TYPE_REMOTE_LATERAL. | 148 | * if the type of overlay connection is #OCC_TYPE_REMOTE_LATERAL. |
149 | */ | 149 | */ |
150 | struct NeighbourConnectNotification *ncn; | 150 | struct NeighbourConnectNotification *ncn; |
151 | 151 | ||
@@ -250,17 +250,17 @@ struct OverlayConnectContext | |||
250 | * The id of the task for sending HELLO of peer 2 to peer 1 and ask peer 1 to | 250 | * The id of the task for sending HELLO of peer 2 to peer 1 and ask peer 1 to |
251 | * connect to peer 2 | 251 | * connect to peer 2 |
252 | */ | 252 | */ |
253 | struct GNUNET_SCHEDULER_Task * send_hello_task; | 253 | struct GNUNET_SCHEDULER_Task *send_hello_task; |
254 | 254 | ||
255 | /** | 255 | /** |
256 | * The id of the overlay connect timeout task | 256 | * The id of the overlay connect timeout task |
257 | */ | 257 | */ |
258 | struct GNUNET_SCHEDULER_Task * timeout_task; | 258 | struct GNUNET_SCHEDULER_Task *timeout_task; |
259 | 259 | ||
260 | /** | 260 | /** |
261 | * The id of the cleanup task | 261 | * The id of the cleanup task |
262 | */ | 262 | */ |
263 | struct GNUNET_SCHEDULER_Task * cleanup_task; | 263 | struct GNUNET_SCHEDULER_Task *cleanup_task; |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * The type of this context information | 266 | * The type of this context information |
@@ -321,12 +321,12 @@ struct RemoteOverlayConnectCtx | |||
321 | /** | 321 | /** |
322 | * Task for offering HELLO of A to B and doing try_connect | 322 | * Task for offering HELLO of A to B and doing try_connect |
323 | */ | 323 | */ |
324 | struct GNUNET_SCHEDULER_Task * attempt_connect_task_id; | 324 | struct GNUNET_SCHEDULER_Task *attempt_connect_task_id; |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Task to timeout RequestOverlayConnect | 327 | * Task to timeout RequestOverlayConnect |
328 | */ | 328 | */ |
329 | struct GNUNET_SCHEDULER_Task * timeout_rocc_task_id; | 329 | struct GNUNET_SCHEDULER_Task *timeout_rocc_task_id; |
330 | 330 | ||
331 | /** | 331 | /** |
332 | * The id of the operation responsible for creating this context | 332 | * The id of the operation responsible for creating this context |
@@ -833,7 +833,8 @@ send_hello_thru_rocc (struct OverlayConnectContext *occ) | |||
833 | * @param tc the TaskContext from scheduler | 833 | * @param tc the TaskContext from scheduler |
834 | */ | 834 | */ |
835 | static void | 835 | static void |
836 | send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 836 | send_hello (void *cls, |
837 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
837 | { | 838 | { |
838 | struct OverlayConnectContext *occ = cls; | 839 | struct OverlayConnectContext *occ = cls; |
839 | struct LocalPeer2Context *lp2c; | 840 | struct LocalPeer2Context *lp2c; |
@@ -879,7 +880,8 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
879 | * @param ignore_ peer identity which is ignored in this callback | 880 | * @param ignore_ peer identity which is ignored in this callback |
880 | */ | 881 | */ |
881 | static void | 882 | static void |
882 | p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | 883 | p2_transport_connect_cache_callback (void *cls, |
884 | struct GNUNET_CORE_Handle *ch, | ||
883 | struct GNUNET_TRANSPORT_Handle *th, | 885 | struct GNUNET_TRANSPORT_Handle *th, |
884 | const struct GNUNET_PeerIdentity *ignore_) | 886 | const struct GNUNET_PeerIdentity *ignore_) |
885 | { | 887 | { |
@@ -888,7 +890,8 @@ p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | |||
888 | GNUNET_assert (OCC_TYPE_LOCAL == occ->type); | 890 | GNUNET_assert (OCC_TYPE_LOCAL == occ->type); |
889 | if (NULL == th) | 891 | if (NULL == th) |
890 | { | 892 | { |
891 | GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s", | 893 | GNUNET_asprintf (&occ->emsg, |
894 | "0x%llx: Cannot connect to TRANSPORT of %s", | ||
892 | occ->op_id, GNUNET_i2s (&occ->other_peer_identity)); | 895 | occ->op_id, GNUNET_i2s (&occ->other_peer_identity)); |
893 | GNUNET_SCHEDULER_cancel (occ->timeout_task); | 896 | GNUNET_SCHEDULER_cancel (occ->timeout_task); |
894 | occ->timeout_task = | 897 | occ->timeout_task = |
@@ -896,8 +899,10 @@ p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | |||
896 | return; | 899 | return; |
897 | } | 900 | } |
898 | occ->p2ctx.local.tcc.th_ = th; | 901 | occ->p2ctx.local.tcc.th_ = th; |
899 | GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s", | 902 | GNUNET_asprintf (&occ->emsg, |
900 | occ->op_id, GNUNET_i2s (&occ->other_peer_identity)); | 903 | "0x%llx: Timeout while offering HELLO to %s", |
904 | occ->op_id, | ||
905 | GNUNET_i2s (&occ->other_peer_identity)); | ||
901 | occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ); | 906 | occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ); |
902 | } | 907 | } |
903 | 908 | ||
@@ -929,8 +934,10 @@ p2_transport_connect (struct OverlayConnectContext *occ) | |||
929 | occ, NULL, NULL, NULL); | 934 | occ, NULL, NULL, NULL); |
930 | return; | 935 | return; |
931 | } | 936 | } |
932 | GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s", | 937 | GNUNET_asprintf (&occ->emsg, |
933 | occ->op_id, GNUNET_i2s (&occ->other_peer_identity)); | 938 | "0x%llx: Timeout while offering HELLO to %s", |
939 | occ->op_id, | ||
940 | GNUNET_i2s (&occ->other_peer_identity)); | ||
934 | occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ); | 941 | occ->send_hello_task = GNUNET_SCHEDULER_add_now (&send_hello, occ); |
935 | } | 942 | } |
936 | 943 | ||
@@ -944,7 +951,8 @@ p2_transport_connect (struct OverlayConnectContext *occ) | |||
944 | * @return | 951 | * @return |
945 | */ | 952 | */ |
946 | static int | 953 | static int |
947 | test_address (void *cls, const struct GNUNET_HELLO_Address *address, | 954 | test_address (void *cls, |
955 | const struct GNUNET_HELLO_Address *address, | ||
948 | struct GNUNET_TIME_Absolute expiration) | 956 | struct GNUNET_TIME_Absolute expiration) |
949 | { | 957 | { |
950 | int *empty = cls; | 958 | int *empty = cls; |
@@ -963,7 +971,8 @@ test_address (void *cls, const struct GNUNET_HELLO_Address *address, | |||
963 | * @param hello our updated HELLO | 971 | * @param hello our updated HELLO |
964 | */ | 972 | */ |
965 | static void | 973 | static void |
966 | hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello) | 974 | hello_update_cb (void *cls, |
975 | const struct GNUNET_MessageHeader *hello) | ||
967 | { | 976 | { |
968 | struct OverlayConnectContext *occ = cls; | 977 | struct OverlayConnectContext *occ = cls; |
969 | int empty; | 978 | int empty; |
@@ -972,15 +981,18 @@ hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello) | |||
972 | msize = ntohs (hello->size); | 981 | msize = ntohs (hello->size); |
973 | empty = GNUNET_YES; | 982 | empty = GNUNET_YES; |
974 | (void) GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *) | 983 | (void) GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *) |
975 | hello, GNUNET_NO, &test_address, | 984 | hello, GNUNET_NO, |
985 | &test_address, | ||
976 | &empty); | 986 | &empty); |
977 | if (GNUNET_YES == empty) | 987 | if (GNUNET_YES == empty) |
978 | { | 988 | { |
979 | LOG_DEBUG ("0x%llx: HELLO of %s is empty\n", occ->op_id, | 989 | LOG_DEBUG ("0x%llx: HELLO of %s is empty\n", |
990 | occ->op_id, | ||
980 | GNUNET_i2s (&occ->peer_identity)); | 991 | GNUNET_i2s (&occ->peer_identity)); |
981 | return; | 992 | return; |
982 | } | 993 | } |
983 | LOG_DEBUG ("0x%llx: Received HELLO of %s\n", occ->op_id, | 994 | LOG_DEBUG ("0x%llx: Received HELLO of %s\n", |
995 | occ->op_id, | ||
984 | GNUNET_i2s (&occ->peer_identity)); | 996 | GNUNET_i2s (&occ->peer_identity)); |
985 | occ->hello = GNUNET_malloc (msize); | 997 | occ->hello = GNUNET_malloc (msize); |
986 | GST_cache_add_hello (occ->peer->id, hello); | 998 | GST_cache_add_hello (occ->peer->id, hello); |
@@ -1015,8 +1027,10 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1015 | occ->emsg = NULL; | 1027 | occ->emsg = NULL; |
1016 | if (NULL == th) | 1028 | if (NULL == th) |
1017 | { | 1029 | { |
1018 | GNUNET_asprintf (&occ->emsg, "0x%llx: Cannot connect to TRANSPORT of %s", | 1030 | GNUNET_asprintf (&occ->emsg, |
1019 | occ->op_id, GNUNET_i2s (&occ->peer_identity)); | 1031 | "0x%llx: Cannot connect to TRANSPORT of %s", |
1032 | occ->op_id, | ||
1033 | GNUNET_i2s (&occ->peer_identity)); | ||
1020 | GNUNET_SCHEDULER_cancel (occ->timeout_task); | 1034 | GNUNET_SCHEDULER_cancel (occ->timeout_task); |
1021 | occ->timeout_task = | 1035 | occ->timeout_task = |
1022 | GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ); | 1036 | GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ); |
@@ -1026,9 +1040,12 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1026 | GNUNET_assert (NULL != occ->cgh_p1th); | 1040 | GNUNET_assert (NULL != occ->cgh_p1th); |
1027 | occ->p1th_ = th; | 1041 | occ->p1th_ = th; |
1028 | GNUNET_asprintf (&occ->emsg, | 1042 | GNUNET_asprintf (&occ->emsg, |
1029 | "0x%llx: Timeout while acquiring HELLO of peer %4s", | 1043 | "0x%llx: Timeout while acquiring HELLO of peer %s", |
1030 | occ->op_id, GNUNET_i2s (&occ->peer_identity)); | 1044 | occ->op_id, |
1031 | occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_, &hello_update_cb, occ); | 1045 | GNUNET_i2s (&occ->peer_identity)); |
1046 | occ->ghh = GNUNET_TRANSPORT_get_hello (occ->p1th_, | ||
1047 | &hello_update_cb, | ||
1048 | occ); | ||
1032 | } | 1049 | } |
1033 | 1050 | ||
1034 | 1051 | ||
@@ -1041,7 +1058,8 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1041 | * @param my_identity the identity of our peer | 1058 | * @param my_identity the identity of our peer |
1042 | */ | 1059 | */ |
1043 | static void | 1060 | static void |
1044 | occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, | 1061 | occ_cache_get_handle_core_cb (void *cls, |
1062 | struct GNUNET_CORE_Handle *ch, | ||
1045 | struct GNUNET_TRANSPORT_Handle *th, | 1063 | struct GNUNET_TRANSPORT_Handle *th, |
1046 | const struct GNUNET_PeerIdentity *my_identity) | 1064 | const struct GNUNET_PeerIdentity *my_identity) |
1047 | { | 1065 | { |
@@ -1054,7 +1072,9 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1054 | { | 1072 | { |
1055 | GNUNET_asprintf (&occ->emsg, | 1073 | GNUNET_asprintf (&occ->emsg, |
1056 | "0x%llx: Failed to connect to CORE of peer with " | 1074 | "0x%llx: Failed to connect to CORE of peer with " |
1057 | "id: %u", occ->op_id, occ->peer->id); | 1075 | "id: %u", |
1076 | occ->op_id, | ||
1077 | occ->peer->id); | ||
1058 | GNUNET_SCHEDULER_cancel (occ->timeout_task); | 1078 | GNUNET_SCHEDULER_cancel (occ->timeout_task); |
1059 | occ->timeout_task = | 1079 | occ->timeout_task = |
1060 | GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ); | 1080 | GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ); |
@@ -1073,7 +1093,8 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1073 | } | 1093 | } |
1074 | memcpy (&occ->peer_identity, my_identity, | 1094 | memcpy (&occ->peer_identity, my_identity, |
1075 | sizeof (struct GNUNET_PeerIdentity)); | 1095 | sizeof (struct GNUNET_PeerIdentity)); |
1076 | LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", occ->op_id, | 1096 | LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", |
1097 | occ->op_id, | ||
1077 | GNUNET_i2s (&occ->peer_identity)); | 1098 | GNUNET_i2s (&occ->peer_identity)); |
1078 | /* Lookup for HELLO in hello cache */ | 1099 | /* Lookup for HELLO in hello cache */ |
1079 | if (NULL != (hello = GST_cache_lookup_hello (occ->peer->id))) | 1100 | if (NULL != (hello = GST_cache_lookup_hello (occ->peer->id))) |
@@ -1105,7 +1126,8 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1105 | * @param msg the peer create success message | 1126 | * @param msg the peer create success message |
1106 | */ | 1127 | */ |
1107 | static void | 1128 | static void |
1108 | overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg) | 1129 | overlay_connect_get_config (void *cls, |
1130 | const struct GNUNET_MessageHeader *msg) | ||
1109 | { | 1131 | { |
1110 | struct OverlayConnectContext *occ = cls; | 1132 | struct OverlayConnectContext *occ = cls; |
1111 | struct RemotePeer2Context *rp2c; | 1133 | struct RemotePeer2Context *rp2c; |
@@ -1123,19 +1145,22 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1123 | } | 1145 | } |
1124 | cmsg = | 1146 | cmsg = |
1125 | (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg; | 1147 | (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg; |
1126 | memcpy (&occ->other_peer_identity, &cmsg->peer_identity, | 1148 | occ->other_peer_identity = cmsg->peer_identity; |
1127 | sizeof (struct GNUNET_PeerIdentity)); | ||
1128 | GNUNET_free_non_null (occ->emsg); | 1149 | GNUNET_free_non_null (occ->emsg); |
1129 | GNUNET_asprintf (&occ->emsg, | 1150 | GNUNET_asprintf (&occ->emsg, |
1130 | "0x%llx: Timeout while connecting to CORE of peer with " | 1151 | "0x%llx: Timeout while connecting to CORE of peer with " |
1131 | "id: %u", occ->op_id, occ->peer->id); | 1152 | "id: %u", |
1153 | occ->op_id, | ||
1154 | occ->peer->id); | ||
1132 | occ->cgh_ch = | 1155 | occ->cgh_ch = |
1133 | GST_connection_pool_get_handle (occ->peer->id, | 1156 | GST_connection_pool_get_handle (occ->peer->id, |
1134 | occ->peer->details.local.cfg, | 1157 | occ->peer->details.local.cfg, |
1135 | GST_CONNECTIONPOOL_SERVICE_CORE, | 1158 | GST_CONNECTIONPOOL_SERVICE_CORE, |
1136 | occ_cache_get_handle_core_cb, occ, | 1159 | occ_cache_get_handle_core_cb, |
1160 | occ, | ||
1137 | &occ->other_peer_identity, | 1161 | &occ->other_peer_identity, |
1138 | &overlay_connect_notify, occ); | 1162 | &overlay_connect_notify, |
1163 | occ); | ||
1139 | return; | 1164 | return; |
1140 | } | 1165 | } |
1141 | 1166 | ||
@@ -1162,12 +1187,13 @@ host_registration_comp (void *cls, const char *emsg) | |||
1162 | * @param cls pointer 2 pointer of RegisteredHostContext | 1187 | * @param cls pointer 2 pointer of RegisteredHostContext |
1163 | * @param key current key code | 1188 | * @param key current key code |
1164 | * @param value value in the hash map | 1189 | * @param value value in the hash map |
1165 | * @return GNUNET_YES if we should continue to | 1190 | * @return #GNUNET_YES if we should continue to |
1166 | * iterate, | 1191 | * iterate, |
1167 | * GNUNET_NO if not. | 1192 | * #GNUNET_NO if not. |
1168 | */ | 1193 | */ |
1169 | static int | 1194 | static int |
1170 | reghost_match_iterator (void *cls, const struct GNUNET_HashCode *key, | 1195 | reghost_match_iterator (void *cls, |
1196 | const struct GNUNET_HashCode *key, | ||
1171 | void *value) | 1197 | void *value) |
1172 | { | 1198 | { |
1173 | struct RegisteredHostContext **rh = cls; | 1199 | struct RegisteredHostContext **rh = cls; |
@@ -1345,7 +1371,8 @@ forward_overlay_connect (const struct GNUNET_TESTBED_OverlayConnectMessage *msg, | |||
1345 | * @param c handle to the controller connection | 1371 | * @param c handle to the controller connection |
1346 | */ | 1372 | */ |
1347 | static void | 1373 | static void |
1348 | p2_controller_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c) | 1374 | p2_controller_connect_cb (void *cls, |
1375 | struct GNUNET_TESTBED_Controller *c) | ||
1349 | { | 1376 | { |
1350 | struct OverlayConnectContext *occ = cls; | 1377 | struct OverlayConnectContext *occ = cls; |
1351 | struct RemotePeer2Context *rp2c; | 1378 | struct RemotePeer2Context *rp2c; |
@@ -1369,19 +1396,22 @@ p2_controller_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c) | |||
1369 | GNUNET_free_non_null (occ->emsg); | 1396 | GNUNET_free_non_null (occ->emsg); |
1370 | GNUNET_asprintf (&occ->emsg, | 1397 | GNUNET_asprintf (&occ->emsg, |
1371 | "0x%llx: Timeout while getting peer identity of peer " | 1398 | "0x%llx: Timeout while getting peer identity of peer " |
1372 | "with id: %u", occ->op_id, occ->other_peer_id); | 1399 | "with id: %u", |
1400 | occ->op_id, | ||
1401 | occ->other_peer_id); | ||
1373 | } | 1402 | } |
1374 | 1403 | ||
1375 | 1404 | ||
1376 | /** | 1405 | /** |
1377 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages | 1406 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT messages |
1378 | * | 1407 | * |
1379 | * @param cls NULL | 1408 | * @param cls NULL |
1380 | * @param client identification of the client | 1409 | * @param client identification of the client |
1381 | * @param message the actual message | 1410 | * @param message the actual message |
1382 | */ | 1411 | */ |
1383 | void | 1412 | void |
1384 | GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | 1413 | GST_handle_overlay_connect (void *cls, |
1414 | struct GNUNET_SERVER_Client *client, | ||
1385 | const struct GNUNET_MessageHeader *message) | 1415 | const struct GNUNET_MessageHeader *message) |
1386 | { | 1416 | { |
1387 | const struct GNUNET_TESTBED_OverlayConnectMessage *msg; | 1417 | const struct GNUNET_TESTBED_OverlayConnectMessage *msg; |
@@ -1413,19 +1443,23 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
1413 | peer = GST_peer_list[p1]; | 1443 | peer = GST_peer_list[p1]; |
1414 | operation_id = GNUNET_ntohll (msg->operation_id); | 1444 | operation_id = GNUNET_ntohll (msg->operation_id); |
1415 | LOG_DEBUG | 1445 | LOG_DEBUG |
1416 | ("Received overlay connect for peers %u and %u with op id: 0x%llx\n", p1, | 1446 | ("Received overlay connect for peers %u and %u with op id: 0x%llx\n", |
1417 | p2, operation_id); | 1447 | p1, |
1448 | p2, | ||
1449 | operation_id); | ||
1418 | peer2_host_id = ntohl (msg->peer2_host_id); | 1450 | peer2_host_id = ntohl (msg->peer2_host_id); |
1419 | if (GNUNET_YES == peer->is_remote) | 1451 | if (GNUNET_YES == peer->is_remote) |
1420 | { | 1452 | { |
1421 | if (!VALID_HOST_ID (peer2_host_id)) | 1453 | if (! VALID_HOST_ID (peer2_host_id)) |
1422 | { | 1454 | { |
1423 | GNUNET_break (0); | 1455 | GNUNET_break (0); |
1424 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1456 | GNUNET_SERVER_receive_done (client, |
1457 | GNUNET_SYSERR); | ||
1425 | return; | 1458 | return; |
1426 | } | 1459 | } |
1427 | forward_overlay_connect (msg, client); | 1460 | forward_overlay_connect (msg, client); |
1428 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1461 | GNUNET_SERVER_receive_done (client, |
1462 | GNUNET_OK); | ||
1429 | return; | 1463 | return; |
1430 | } | 1464 | } |
1431 | p2n = NULL; | 1465 | p2n = NULL; |
@@ -1441,7 +1475,8 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
1441 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1475 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1442 | "0x%llx: Peer %u's host not in our neighbours list\n", | 1476 | "0x%llx: Peer %u's host not in our neighbours list\n", |
1443 | operation_id, p2); | 1477 | operation_id, p2); |
1444 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1478 | GNUNET_SERVER_receive_done (client, |
1479 | GNUNET_SYSERR); | ||
1445 | GNUNET_free (occ); | 1480 | GNUNET_free (occ); |
1446 | return; | 1481 | return; |
1447 | } | 1482 | } |
@@ -1455,7 +1490,9 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
1455 | occ->type = OCC_TYPE_REMOTE_SLAVE; | 1490 | occ->type = OCC_TYPE_REMOTE_SLAVE; |
1456 | occ->p2ctx.remote.p2c = GST_peer_list[p2]->details.remote.slave->controller; | 1491 | occ->p2ctx.remote.p2c = GST_peer_list[p2]->details.remote.slave->controller; |
1457 | } | 1492 | } |
1458 | GNUNET_CONTAINER_DLL_insert_tail (occq_head, occq_tail, occ); | 1493 | GNUNET_CONTAINER_DLL_insert_tail (occq_head, |
1494 | occq_tail, | ||
1495 | occ); | ||
1459 | GNUNET_SERVER_client_keep (client); | 1496 | GNUNET_SERVER_client_keep (client); |
1460 | occ->client = client; | 1497 | occ->client = client; |
1461 | occ->other_peer_id = p2; | 1498 | occ->other_peer_id = p2; |
@@ -1464,13 +1501,18 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
1464 | occ->op_id = operation_id; | 1501 | occ->op_id = operation_id; |
1465 | GNUNET_assert (NULL == occ->timeout_task); | 1502 | GNUNET_assert (NULL == occ->timeout_task); |
1466 | occ->timeout_task = | 1503 | occ->timeout_task = |
1467 | GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_overlay_connect, occ); | 1504 | GNUNET_SCHEDULER_add_delayed (GST_timeout, |
1505 | &timeout_overlay_connect, | ||
1506 | occ); | ||
1468 | switch (occ->type) | 1507 | switch (occ->type) |
1469 | { | 1508 | { |
1470 | case OCC_TYPE_REMOTE_LATERAL: | 1509 | case OCC_TYPE_REMOTE_LATERAL: |
1471 | GNUNET_asprintf (&occ->emsg, | 1510 | GNUNET_asprintf (&occ->emsg, |
1472 | "0x%llx: Timeout while acquiring connection to peer %u's " | 1511 | "0x%llx: Timeout while acquiring connection to peer %u's " |
1473 | "host: %u\n", occ->op_id, occ->other_peer_id, peer2_host_id); | 1512 | "host: %u\n", |
1513 | occ->op_id, | ||
1514 | occ->other_peer_id, | ||
1515 | peer2_host_id); | ||
1474 | occ->p2ctx.remote.ncn = | 1516 | occ->p2ctx.remote.ncn = |
1475 | GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ); | 1517 | GST_neighbour_get_connection (p2n, &p2_controller_connect_cb, occ); |
1476 | break; | 1518 | break; |
@@ -1484,7 +1526,9 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
1484 | &occ->other_peer_identity); | 1526 | &occ->other_peer_identity); |
1485 | GNUNET_asprintf (&occ->emsg, | 1527 | GNUNET_asprintf (&occ->emsg, |
1486 | "0x%llx: Timeout while connecting to CORE of peer with " | 1528 | "0x%llx: Timeout while connecting to CORE of peer with " |
1487 | "id: %u", occ->op_id, occ->peer->id); | 1529 | "id: %u", |
1530 | occ->op_id, | ||
1531 | occ->peer->id); | ||
1488 | occ->cgh_ch = | 1532 | occ->cgh_ch = |
1489 | GST_connection_pool_get_handle (occ->peer->id, | 1533 | GST_connection_pool_get_handle (occ->peer->id, |
1490 | occ->peer->details.local.cfg, | 1534 | occ->peer->details.local.cfg, |
@@ -1537,13 +1581,15 @@ cleanup_rocc (struct RemoteOverlayConnectCtx *rocc) | |||
1537 | * @param tc the TaskContext from scheduler | 1581 | * @param tc the TaskContext from scheduler |
1538 | */ | 1582 | */ |
1539 | static void | 1583 | static void |
1540 | timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1584 | timeout_rocc_task (void *cls, |
1585 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
1541 | { | 1586 | { |
1542 | struct RemoteOverlayConnectCtx *rocc = cls; | 1587 | struct RemoteOverlayConnectCtx *rocc = cls; |
1543 | 1588 | ||
1544 | GNUNET_assert (rocc->timeout_rocc_task_id != NULL); | 1589 | GNUNET_assert (rocc->timeout_rocc_task_id != NULL); |
1545 | rocc->timeout_rocc_task_id = NULL; | 1590 | rocc->timeout_rocc_task_id = NULL; |
1546 | LOG_DEBUG ("0x%llx: rocc timed out\n", rocc->op_id); | 1591 | LOG_DEBUG ("0x%llx: rocc timed out\n", |
1592 | rocc->op_id); | ||
1547 | cleanup_rocc (rocc); | 1593 | cleanup_rocc (rocc); |
1548 | } | 1594 | } |
1549 | 1595 | ||
@@ -1561,11 +1607,13 @@ cache_transport_peer_connect_notify (void *cls, | |||
1561 | { | 1607 | { |
1562 | struct RemoteOverlayConnectCtx *rocc = cls; | 1608 | struct RemoteOverlayConnectCtx *rocc = cls; |
1563 | 1609 | ||
1564 | LOG_DEBUG ("0x%llx: Request Overlay connect notify\n", rocc->op_id); | 1610 | LOG_DEBUG ("0x%llx: Request Overlay connect notify\n", |
1611 | rocc->op_id); | ||
1565 | GNUNET_assert (0 == | 1612 | GNUNET_assert (0 == |
1566 | memcmp (new_peer, &rocc->a_id, | 1613 | memcmp (new_peer, &rocc->a_id, |
1567 | sizeof (struct GNUNET_PeerIdentity))); | 1614 | sizeof (struct GNUNET_PeerIdentity))); |
1568 | LOG_DEBUG ("0x%llx: Peer %4s connected\n", rocc->op_id, | 1615 | LOG_DEBUG ("0x%llx: Peer %4s connected\n", |
1616 | rocc->op_id, | ||
1569 | GNUNET_i2s (&rocc->a_id)); | 1617 | GNUNET_i2s (&rocc->a_id)); |
1570 | cleanup_rocc (rocc); | 1618 | cleanup_rocc (rocc); |
1571 | } | 1619 | } |
@@ -1579,7 +1627,8 @@ cache_transport_peer_connect_notify (void *cls, | |||
1579 | * @param tc the TaskContext from scheduler | 1627 | * @param tc the TaskContext from scheduler |
1580 | */ | 1628 | */ |
1581 | static void | 1629 | static void |
1582 | attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 1630 | attempt_connect_task (void *cls, |
1631 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
1583 | 1632 | ||
1584 | 1633 | ||
1585 | /** | 1634 | /** |
@@ -1587,8 +1636,8 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
1587 | * | 1636 | * |
1588 | * @param cls the overlay connect context | 1637 | * @param cls the overlay connect context |
1589 | * @param tc the scheduler task context; if tc->reason = | 1638 | * @param tc the scheduler task context; if tc->reason = |
1590 | * GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if | 1639 | * #GNUNET_SCHEDULER_REASON_TIMEOUT then sending HELLO failed; if |
1591 | * GNUNET_SCHEDULER_REASON_READ_READY is succeeded | 1640 | * #GNUNET_SCHEDULER_REASON_READ_READY is succeeded |
1592 | */ | 1641 | */ |
1593 | static void | 1642 | static void |
1594 | rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 1643 | rocc_hello_sent_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
@@ -1672,7 +1721,9 @@ rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1672 | GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, rocc->tcc.pid)) | 1721 | GNUNET_TRANSPORT_check_peer_connected (rocc->tcc.th_, rocc->tcc.pid)) |
1673 | { | 1722 | { |
1674 | LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n", | 1723 | LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n", |
1675 | rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id); | 1724 | rocc->op_id, |
1725 | GNUNET_i2s (&rocc->a_id), | ||
1726 | rocc->peer->id); | ||
1676 | cleanup_rocc (rocc); | 1727 | cleanup_rocc (rocc); |
1677 | return; | 1728 | return; |
1678 | } | 1729 | } |
@@ -1682,7 +1733,7 @@ rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, | |||
1682 | 1733 | ||
1683 | 1734 | ||
1684 | /** | 1735 | /** |
1685 | * Handler for GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT messages | 1736 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_REQUEST_CONNECT messages |
1686 | * | 1737 | * |
1687 | * @param cls NULL | 1738 | * @param cls NULL |
1688 | * @param client identification of the client | 1739 | * @param client identification of the client |
@@ -1751,7 +1802,10 @@ GST_handle_remote_overlay_connect (void *cls, | |||
1751 | GNUNET_TESTING_peer_get_identity (peer->details.local.peer, &pid); | 1802 | GNUNET_TESTING_peer_get_identity (peer->details.local.peer, &pid); |
1752 | (void) strncpy (pid_str, GNUNET_i2s (&pid), 15); | 1803 | (void) strncpy (pid_str, GNUNET_i2s (&pid), 15); |
1753 | LOG_DEBUG ("0x%llx: Remote overlay connect %4s to peer %4s with hello size: %u\n", | 1804 | LOG_DEBUG ("0x%llx: Remote overlay connect %4s to peer %4s with hello size: %u\n", |
1754 | rocc->op_id, pid_str, GNUNET_i2s (&rocc->a_id), hsize); | 1805 | rocc->op_id, |
1806 | pid_str, | ||
1807 | GNUNET_i2s (&rocc->a_id), | ||
1808 | hsize); | ||
1755 | rocc->peer = peer; | 1809 | rocc->peer = peer; |
1756 | rocc->peer->reference_cnt++; | 1810 | rocc->peer->reference_cnt++; |
1757 | rocc->hello = GNUNET_malloc (hsize); | 1811 | rocc->hello = GNUNET_malloc (hsize); |
@@ -1767,7 +1821,9 @@ GST_handle_remote_overlay_connect (void *cls, | |||
1767 | &cache_transport_peer_connect_notify, | 1821 | &cache_transport_peer_connect_notify, |
1768 | rocc); | 1822 | rocc); |
1769 | rocc->timeout_rocc_task_id = | 1823 | rocc->timeout_rocc_task_id = |
1770 | GNUNET_SCHEDULER_add_delayed (GST_timeout, &timeout_rocc_task, rocc); | 1824 | GNUNET_SCHEDULER_add_delayed (GST_timeout, |
1825 | &timeout_rocc_task, | ||
1826 | rocc); | ||
1771 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1827 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1772 | } | 1828 | } |
1773 | 1829 | ||