Пример #1
0
void extend_network(char *ip, char *port, int socketNo) {

	if (initializeConnection(ip, port, socketNo) == -1) {
		printf("The connection could not be established on socket: %d with Ip:  %s  ", socketNo, ip);
	}
	else {
		printf("Trying to extend network with %s on port %s and socket %u\n\n", ip, port, socketNo);

		printf("Join request was sent to %s on socket %d. Waiting for join response. \n", ip, socketNo);
		send_join_request(socketNo);
	}
}
Пример #2
0
// Received an event that a simulation is starting
static void start_cb (flux_t *h,
                      flux_msg_handler_t *w,
                      const flux_msg_t *msg,
                      void *arg)
{
    flux_log (h, LOG_DEBUG, "received a start event");
    if (send_join_request (h, module_name, -1) < 0) {
        flux_log (h, LOG_ERR, "failed to register with sim module");
        return;
    }
    flux_log (h, LOG_DEBUG, "sent a join request");

    if (flux_event_unsubscribe (h, "sim.start") < 0) {
        flux_log (h, LOG_ERR, "failed to unsubscribe from \"sim.start\"");
    } else {
        flux_log (h, LOG_DEBUG, "unsubscribed from \"sim.start\"");
    }
}