src/mn-masterd/auth.c
static int
nol_m_token_reply(nolp_t *no, char *buf, int size)
{
    int           sz;
    char          out[70];
    struct conn  *client;
    struct conn  *conn = (struct conn*)no->private;
    slave_conn_t *sl = &srv.slaves[conn->slave_n];
    if (!(client = sl->client_conn))
        /* client must have disconnected before 
         * we replied */
        return 0;

    if (atoi(buf) == 100) {
        sz = sprintf(out, "TOKEN %.40s-%.15s:%hd\n", buf+4,
                sl->listen_addr,
                sl->listen_port);
        send(client->sock, out, sz, 0);
    }

    /* stop and disconnect the client connection */
    ev_io_stop(EV_DEFAULT, &client->fd_ev);
    nol_m_conn_close(client);

    return 0;
}
/** 
 * return 0 if the token was read and sent to the 
 * corresponding client successfully
 **/
return 0 if the token was read and sent to the
corresponding client successfully
return 0 if the token was read and sent to the corresponding client successfully
static int
nol_m_token_reply(nolp_t *no, char *buf, int size)
{
    int           sz;
    char          out[70];
    struct conn  *client;
    struct conn  *conn = (struct conn*)no->private;
    slave_conn_t *sl = &srv.slaves[conn->slave_n];
    if (!(client = sl->client_conn))
        return 0;
    if (atoi(buf) == 100) {
        sz = sprintf(out, "TOKEN %.40s-%.15s:%hd\n", buf+4,
                sl->listen_addr,
                sl->listen_port);
        send(client->sock, out, sz, 0);
    }
    ev_io_stop(EV_DEFAULT, &client->fd_ev);
    nol_m_conn_close(client);
    return 0;
}
static int nol_m_token_reply ( nolp_t * no , char * buf , int size ) { int sz ; char out [ 70 ] ; struct conn * client ; struct conn * conn = ( struct conn * ) no -> private ; slave_conn_t * sl = & srv . slaves [ conn -> slave_n ] ; if ( ! ( client = sl -> client_conn ) ) return 0 ; if ( atoi ( buf ) == 100 ) { sz = sprintf ( out , " \n " , buf + 4 , sl -> listen_addr , sl -> listen_port ) ; send ( client -> sock , out , sz , 0 ) ; } ev_io_stop ( EV_DEFAULT , & client -> fd_ev ) ; nol_m_conn_close ( client ) ; return 0 ; }
return 0 if the token was read and sent to the
 corresponding client successfully
return 0 if the token was read and sent to the corresponding client successfully
/* client must have disconnected before 
         * we replied */ /* stop and disconnect the client connection */