* @param msg the peer create success message
*/
static void
-forwarded_link_controllers_reply_relay (void *cls,
- const struct GNUNET_MessageHeader *msg)
+forwarded_operation_reply_relay (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct ForwardedOperationContext *fopc = cls;
struct GNUNET_MessageHeader *dup_msg;
queue_message (fopc->client, dup_msg);
GNUNET_SERVER_client_drop (fopc->client);
GNUNET_SCHEDULER_cancel (fopc->timeout_task);
- GNUNET_free (fopc);
+ GNUNET_free (fopc);
}
* @param tc the task context from scheduler
*/
static void
-forwarded_link_controllers_timeout (void *cls,
+forwarded_operation_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext
*tc)
{
struct ForwardedOperationContext *fopc = cls;
GNUNET_TESTBED_forward_operation_msg_cancel_ (fopc->opc);
+ send_operation_fail_msg (fopc->client, fopc->operation_id, "Timeout");
GNUNET_SERVER_client_drop (fopc->client);
GNUNET_free (fopc);
}
GNUNET_TESTBED_forward_operation_msg_ (lcf->gateway->controller,
lcf->operation_id,
&lcf->msg->header,
- &forwarded_link_controllers_reply_relay,
+ &forwarded_operation_reply_relay,
fopc);
fopc->timeout_task =
GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &forwarded_link_controllers_timeout, fopc);
+ &forwarded_operation_timeout, fopc);
lcf->state = FINISHED;
lcf_proc_task_id = GNUNET_SCHEDULER_add_now (&lcf_proc_task, lcf);
break;
const struct GNUNET_MessageHeader *message)
{
const struct GNUNET_TESTBED_PeerDestroyMessage *msg;
+ struct ForwardedOperationContext *fopc;
struct Peer *peer;
uint32_t peer_id;
if ((peer_list_size <= peer_id) || (NULL == peer_list[peer_id]))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- "Asked for destroy when peer not created at us\n");
+ "Asked to destroy a non existent peer with id: %u\n", peer_id);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
if (GNUNET_YES == peer->is_remote)
{
/* Forward the destory message to sub controller */
- GNUNET_break (0);
+ fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+ GNUNET_SERVER_client_keep (client);
+ fopc->client = client;
+ fopc->operation_id = GNUNET_ntohll (msg->operation_id);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
+ &msg->header,
+ &forwarded_operation_reply_relay,
+ fopc);
+ fopc->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &forwarded_operation_timeout, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
{
const struct GNUNET_TESTBED_PeerStartMessage *msg;
struct GNUNET_TESTBED_PeerEventMessage *reply;
+ struct ForwardedOperationContext *fopc;
+ struct Peer *peer;
uint32_t peer_id;
msg = (const struct GNUNET_TESTBED_PeerStartMessage *) message;
|| (NULL == peer_list[peer_id]))
{
GNUNET_break (0);
- /* FIXME: reply with failure message or forward to slave controller */
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Asked to start a non existent peer with id: %u\n", peer_id);
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ return;
+ }
+ peer = peer_list[peer_id];
+ if (GNUNET_YES == peer->is_remote)
+ {
+ fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+ GNUNET_SERVER_client_keep (client);
+ fopc->client = client;
+ fopc->operation_id = GNUNET_ntohll (msg->operation_id);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
+ &msg->header,
+ &forwarded_operation_reply_relay,
+ fopc);
+ fopc->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &forwarded_operation_timeout, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
if (GNUNET_OK !=
- GNUNET_TESTING_peer_start (peer_list[peer_id]->details.local.peer))
+ GNUNET_TESTING_peer_start (peer->details.local.peer))
{
- /* FIXME: return FAILURE message */
- GNUNET_break (0);
+ send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
+ "Failed to start");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
{
const struct GNUNET_TESTBED_PeerStopMessage *msg;
struct GNUNET_TESTBED_PeerEventMessage *reply;
+ struct ForwardedOperationContext *fopc;
+ struct Peer *peer;
uint32_t peer_id;
msg = (const struct GNUNET_TESTBED_PeerStopMessage *) message;
peer_id = ntohl (msg->peer_id);
if ((peer_id >= peer_list_size) || (NULL == peer_list[peer_id]))
+ {
+ send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
+ "Peer not found");
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ return;
+ }
+ peer = peer_list[peer_id];
+ if (GNUNET_YES == peer->is_remote)
{
- GNUNET_break (0); /* FIXME: route to slave? */
+ fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+ GNUNET_SERVER_client_keep (client);
+ fopc->client = client;
+ fopc->operation_id = GNUNET_ntohll (msg->operation_id);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
+ &msg->header,
+ &forwarded_operation_reply_relay,
+ fopc);
+ fopc->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &forwarded_operation_timeout, fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
if (GNUNET_OK !=
- GNUNET_TESTING_peer_stop (peer_list[peer_id]->details.local.peer))
+ GNUNET_TESTING_peer_stop (peer->details.local.peer))
{
- /* FIXME: return FAILURE message */
- GNUNET_break (0);
+ send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
+ "Failed to stop peer");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
peer_id = ntohl (msg->peer_id);
if ((peer_id >= peer_list_size) || (NULL == peer_list[peer_id]))
{
- /* FIXME: return FAILURE message */
- GNUNET_break (0);
+ send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
+ "Peer not found");
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
/**
* Task which will be run when overlay connect request has been timed out
*
- * @param
- * @return
+ * @param cls the OverlayConnectContext
+ * @param tc the TaskContext
*/
static void
timeout_overlay_connect (void *cls,