Esempio n. 1
0
static void *do_wait(void *args)
{
    nssi_service svc;

    // service init
    nssi_service_init(NSSI_DEFAULT_TRANSPORT, NSSI_SHORT_REQUEST_SIZE, &svc);
    nssi_get_url(NSSI_DEFAULT_TRANSPORT, &my_url[0], NSSI_URL_LEN);

    // client is waiting for us to initialize
    pthread_barrier_wait(&barrier);

    svc.max_reqs = -1;
    int rc = nssi_service_start(&svc);
    if (rc != NSSI_OK) {
        log_info(selfsend_debug_level, "exited selfsend_svc: %s",
                 nssi_err_str(rc));
    }

    /* finalize the service */
    nssi_service_fini(&svc);

    return(NULL);
}
Esempio n. 2
0
/**
 * @brief The NSSI injection-server.
 *
 * NSSI has already been initialized and the client already knows the URL of the
 * server.  This function simply registers the server methods and starts the
 * service loop.   The client will send a request to kill the service upon completion.
 *
 */
int injection_server_main(struct injection_args &args, MPI_Comm server_comm)
{
    int rc = NSSI_OK;

    nssi_service injection_svc;
    log_level debug_level;
    int server_rank;

    MPI_Comm_rank(server_comm, &server_rank);

    /* options that can be overriden by the command-line */
    int verbose = 3;  /* default debug_level */
    std::string server_url(NSSI_URL_LEN, '\0');          /* NNTI-style url of the server */
    std::string logfile("");
    const char *log_str=NULL;


    memset(&injection_svc, 0, sizeof(nssi_service));


    /* initialize the nssi service */
    rc = nssi_service_init((nssi_rpc_transport)args.transport, NSSI_SHORT_REQUEST_SIZE, &injection_svc);
    if (rc != NSSI_OK) {
        log_error(injection_debug_level, "could not init injection_svc: %s",
                nssi_err_str(rc));
        return -1;
    }

    // register callbacks for the service methods
    NSSI_REGISTER_SERVER_STUB(INJECTION_EMPTY_REQUEST_OP, injection_empty_request_srvr, void, void);


    // Get the Server URL
    std::string url(NSSI_URL_LEN, '\0');
    nssi_get_url((nssi_rpc_transport)args.transport, &url[0], NSSI_URL_LEN);


    // Set the maxumum number of requests to handle (-1 == infinite)
    injection_svc.max_reqs = -1;
    //        injection_svc.progress_callback=(uint64_t)make_progress;
    //        injection_svc.progress_callback_timeout=100;

    log_debug(injection_debug_level, "Starting Server: url = %s", url.c_str());

    // Tell the NSSI server to output log data
    //rpc_debug_level = injection_debug_level;

    // start processing requests, the client will send a request to exit when done
    rc = nssi_service_start(&injection_svc);
    if (rc != NSSI_OK) {
        log_info(injection_debug_level, "exited injection_svc: %s",
                nssi_err_str(rc));
    }

    sleep(5);

    /* shutdown the injection_svc */
    log_debug(injection_debug_level, "shutting down service library");
    nssi_service_fini(&injection_svc);


    return rc;
}