[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23725 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23725 - gnunet/src/testbed |
Date: |
Sun, 9 Sep 2012 16:20:50 +0200 |
Author: harsha
Date: 2012-09-09 16:20:50 +0200 (Sun, 09 Sep 2012)
New Revision: 23725
Modified:
gnunet/src/testbed/gnunet-service-testbed.c
gnunet/src/testbed/testbed_api.c
gnunet/src/testbed/testbed_api.h
gnunet/src/testbed/testbed_api_services.c
Log:
error reporting in service_connect
Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-09-09 13:52:13 UTC (rev
23724)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-09-09 14:20:50 UTC (rev
23725)
@@ -930,7 +930,7 @@
}
return;
-registration_error:
+ registration_error:
LOG (GNUNET_ERROR_TYPE_WARNING, "Host registration failed with message:
%s\n",
emsg);
lcf->state = FINISHED;
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2012-09-09 13:52:13 UTC (rev 23724)
+++ gnunet/src/testbed/testbed_api.c 2012-09-09 14:20:50 UTC (rev 23725)
@@ -1758,4 +1758,33 @@
return cfg;
}
+
+/**
+ * Checks the integrity of the OpeationFailureEventMessage and if good returns
+ * the error message it contains.
+ *
+ * @param msg the OperationFailureEventMessage
+ * @return the error message
+ */
+const char *
+GNUNET_TESTBED_parse_error_string_ (const struct
+ GNUNET_TESTBED_OperationFailureEventMessage
+ *msg)
+{
+ uint16_t msize;
+ const char *emsg;
+
+ msize = ntohs (msg->header.size);
+ if (sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage) == msize)
+ return NULL;
+ msize -= sizeof (struct GNUNET_TESTBED_OperationFailureEventMessage);
+ emsg = (const char *) &msg[1];
+ if ('\0' != emsg[msize])
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ return emsg;
+}
+
/* end of testbed_api.c */
Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h 2012-09-09 13:52:13 UTC (rev 23724)
+++ gnunet/src/testbed/testbed_api.h 2012-09-09 14:20:50 UTC (rev 23725)
@@ -398,5 +398,18 @@
GNUNET_TESTBED_PeerConfigurationInformationMessage
*msg);
+
+/**
+ * Checks the integrity of the OpeationFailureEventMessage and if good returns
+ * the error message it contains.
+ *
+ * @param msg the OperationFailureEventMessage
+ * @return the error message
+ */
+const char *
+GNUNET_TESTBED_parse_error_string_ (const struct
+ GNUNET_TESTBED_OperationFailureEventMessage
+ *msg);
+
#endif
/* end of testbed_api.h */
Modified: gnunet/src/testbed/testbed_api_services.c
===================================================================
--- gnunet/src/testbed/testbed_api_services.c 2012-09-09 13:52:13 UTC (rev
23724)
+++ gnunet/src/testbed/testbed_api_services.c 2012-09-09 14:20:50 UTC (rev
23725)
@@ -138,30 +138,42 @@
struct ServiceConnectData *data = cls;
const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *imsg;
struct GNUNET_TESTBED_Controller *c;
+ const char *emsg;
struct GNUNET_TESTBED_EventInformation info;
uint16_t mtype;
mtype = ntohs (msg->type);
+ emsg = NULL;
+ info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
+ info.details.operation_finished.operation = data->operation;
+ info.details.operation_finished.op_cls = data->op_cls;
if (GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT == mtype)
{
- GNUNET_assert (0); /* FIXME: Add notification for failure
*/
- }
+ emsg = GNUNET_TESTBED_parse_error_string_ ((const struct
+
GNUNET_TESTBED_OperationFailureEventMessage
+ *) msg);
+ if (NULL == emsg)
+ emsg = "Unknown error";
+ info.details.operation_finished.emsg = emsg;
+ info.details.operation_finished.generic = NULL;
+ goto call_cb;
+ }
imsg =
(const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
data->cfg = GNUNET_TESTBED_get_config_from_peerinfo_msg_ (imsg);
- data->op_result = data->ca (data->cada_cls, data->cfg);
- info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
- info.details.operation_finished.operation = data->operation;
- info.details.operation_finished.op_cls = data->op_cls;
+ GNUNET_assert (NULL == data->op_result);
+ data->op_result = data->ca (data->cada_cls, data->cfg);
info.details.operation_finished.emsg = NULL;
info.details.operation_finished.generic = data->op_result;
c = data->peer->controller;
data->state = SERVICE_CONNECTED;
+
+ call_cb:
if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
(NULL != c->cc))
c->cc (c->cc_cls, &info);
if (NULL != data->cb)
- data->cb (data->cb_cls, data->operation, data->op_result, NULL);
+ data->cb (data->cb_cls, data->operation, data->op_result, emsg);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23725 - gnunet/src/testbed,
gnunet <=