- if (NULL != op_result)
- GNUNET_DHT_disconnect (op_result);
- GNUNET_assert (PEER_SERVICE_CONNECT == sub_test);
- GNUNET_assert (NULL != operation);
- operation = GNUNET_TESTBED_peer_stop (peer);
- GNUNET_assert (NULL != operation);
+ FAIL_TEST (NULL != op_result, return);
+ FAIL_TEST (op_result == arm_handle, return);
+ GNUNET_ARM_disconnect_and_free (arm_handle);
+ arm_handle = NULL;
+ FAIL_TEST (PEER_SERVICE_CONNECT == sub_test, return);
+ FAIL_TEST (NULL != operation, return);
+ operation = GNUNET_TESTBED_peer_stop (NULL, peer, NULL, NULL);
+ FAIL_TEST (NULL != operation, return);
+}
+
+
+/**
+ * Callback to be called when a service connect operation is completed
+ *
+ * @param cls the callback closure from functions generating an operation
+ * @param op the operation that has been finished
+ * @param ca_result the service handle returned from GNUNET_TESTBED_ConnectAdapter()
+ * @param emsg error message in case the operation has failed; will be NULL if
+ * operation has executed successfully.
+ */
+static void
+service_connect_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
+ void *ca_result, const char *emsg)
+{
+ switch (sub_test)
+ {
+ case PEER_SERVICE_CONNECT:
+ FAIL_TEST (operation == op, return);
+ FAIL_TEST (NULL == emsg, return);
+ FAIL_TEST (NULL == cls, return);
+ FAIL_TEST (ca_result == arm_handle, return);
+ GNUNET_TESTBED_operation_done (operation); /* This results in call to
+ * disconnect adapter */
+ break;
+ default:
+ FAIL_TEST (0, return);
+ }