aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_services.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-09-09 14:20:50 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-09-09 14:20:50 +0000
commit7666505af72b1ca0b568f1c8a053a506dda64d95 (patch)
tree229314c99af16e5dd7686beaa53e11ef5593d1bc /src/testbed/testbed_api_services.c
parent58d35329939062c00b165a973ad236490678eca3 (diff)
downloadgnunet-7666505af72b1ca0b568f1c8a053a506dda64d95.tar.gz
gnunet-7666505af72b1ca0b568f1c8a053a506dda64d95.zip
error reporting in service_connect
Diffstat (limited to 'src/testbed/testbed_api_services.c')
-rw-r--r--src/testbed/testbed_api_services.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/testbed/testbed_api_services.c b/src/testbed/testbed_api_services.c
index c3375a9c7..62bafb724 100644
--- a/src/testbed/testbed_api_services.c
+++ b/src/testbed/testbed_api_services.c
@@ -138,30 +138,42 @@ configuration_receiver (void *cls, const struct GNUNET_MessageHeader *msg)
138 struct ServiceConnectData *data = cls; 138 struct ServiceConnectData *data = cls;
139 const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *imsg; 139 const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *imsg;
140 struct GNUNET_TESTBED_Controller *c; 140 struct GNUNET_TESTBED_Controller *c;
141 const char *emsg;
141 struct GNUNET_TESTBED_EventInformation info; 142 struct GNUNET_TESTBED_EventInformation info;
142 uint16_t mtype; 143 uint16_t mtype;
143 144
144 mtype = ntohs (msg->type); 145 mtype = ntohs (msg->type);
146 emsg = NULL;
147 info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED;
148 info.details.operation_finished.operation = data->operation;
149 info.details.operation_finished.op_cls = data->op_cls;
145 if (GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT == mtype) 150 if (GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT == mtype)
146 { 151 {
147 GNUNET_assert (0); /* FIXME: Add notification for failure */ 152 emsg = GNUNET_TESTBED_parse_error_string_ ((const struct
148 } 153 GNUNET_TESTBED_OperationFailureEventMessage
154 *) msg);
155 if (NULL == emsg)
156 emsg = "Unknown error";
157 info.details.operation_finished.emsg = emsg;
158 info.details.operation_finished.generic = NULL;
159 goto call_cb;
160 }
149 imsg = 161 imsg =
150 (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg; 162 (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) msg;
151 data->cfg = GNUNET_TESTBED_get_config_from_peerinfo_msg_ (imsg); 163 data->cfg = GNUNET_TESTBED_get_config_from_peerinfo_msg_ (imsg);
152 data->op_result = data->ca (data->cada_cls, data->cfg); 164 GNUNET_assert (NULL == data->op_result);
153 info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED; 165 data->op_result = data->ca (data->cada_cls, data->cfg);
154 info.details.operation_finished.operation = data->operation;
155 info.details.operation_finished.op_cls = data->op_cls;
156 info.details.operation_finished.emsg = NULL; 166 info.details.operation_finished.emsg = NULL;
157 info.details.operation_finished.generic = data->op_result; 167 info.details.operation_finished.generic = data->op_result;
158 c = data->peer->controller; 168 c = data->peer->controller;
159 data->state = SERVICE_CONNECTED; 169 data->state = SERVICE_CONNECTED;
170
171 call_cb:
160 if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) && 172 if ((0 != (GNUNET_TESTBED_ET_OPERATION_FINISHED & c->event_mask)) &&
161 (NULL != c->cc)) 173 (NULL != c->cc))
162 c->cc (c->cc_cls, &info); 174 c->cc (c->cc_cls, &info);
163 if (NULL != data->cb) 175 if (NULL != data->cb)
164 data->cb (data->cb_cls, data->operation, data->op_result, NULL); 176 data->cb (data->cb_cls, data->operation, data->op_result, emsg);
165} 177}
166 178
167 179