src/siri/admin/client.c
/*
 * Send a package to the 'other' SiriDB server. This function can be used for
 * sending api requests for all database information required to create the
 * database. Note that all packages are send with the same pid so packages
 * should be send in sequence, not parallel.
 *
 * Note: pkg will be freed by calling this function.
 */
Send a package to the 'other' SiriDB server. This function can be used for
sending api requests for all database information required to create the
database. Note that all packages are send with the same pid so packages
should be send in sequence, not parallel.

pkg will be freed by calling this function.
Send a package to the ' other ' SiriDB server . This function can be used for sending api requests for all database information required to create the database . Note that all packages are send with the same pid so packages should be send in sequence not parallel . pkg will be freed by calling this function .
static void CLIENT_send_pkg(
        siri_admin_client_t * adm_client,
        sirinet_pkg_t * pkg)
{
    uv_write_t * req = (uv_write_t *) malloc(sizeof(uv_write_t));
    if (req == NULL)
    {
        free(pkg);
        CLIENT_err(adm_client, "memory allocation error");
    }
    req->data = adm_client;
    adm_client->pkg = pkg;
    pkg->checkbit = pkg->tp ^ 255;
    uv_timer_start(
            &siri.timer,
            CLIENT_request_timeout,
            CLIENT_REQUEST_TIMEOUT,
            0);
    siri.timer.data = adm_client;
    uv_buf_t wrbuf = uv_buf_init(
            (char *) pkg,
            sizeof(sirinet_pkg_t) + pkg->len);
    uv_write(
            req,
            (uv_stream_t *) siri.socket,
            &wrbuf,
            1,
            CLIENT_write_cb);
}
static void CLIENT_send_pkg ( siri_admin_client_t * adm_client , sirinet_pkg_t * pkg ) { uv_write_t * req = ( uv_write_t * ) malloc ( sizeof ( uv_write_t ) ) ; if ( req == NULL ) { free ( pkg ) ; CLIENT_err ( adm_client , " " ) ; } req -> data = adm_client ; adm_client -> pkg = pkg ; pkg -> checkbit = pkg -> tp ^ 255 ; uv_timer_start ( & siri . timer , CLIENT_request_timeout , CLIENT_REQUEST_TIMEOUT , 0 ) ; siri . timer . data = adm_client ; uv_buf_t wrbuf = uv_buf_init ( ( char * ) pkg , sizeof ( sirinet_pkg_t ) + pkg -> len ) ; uv_write ( req , ( uv_stream_t * ) siri . socket , & wrbuf , 1 , CLIENT_write_cb ) ; }
Send a package to the 'other' SiriDB server.
Send a package to the ' other ' SiriDB server .
/* set the correct check bit */