src/mn-masterd/auth.c
static int
send_hooks(int sock)
{
    char buf[96];
    int  x;
    int  sz;
    static const char *s[] = {
        "session-complete",
        "cleanup",
    };
    for (x=0; x<NUM_HOOKS; x++) {
        if (srv.hooks[x].sz) {
            sz = sprintf(buf, "HOOK %.32s %d\n",
                    s[x], (int)srv.hooks[x].sz
                    );
            if (send(sock, buf, sz, 0) <= 0)
                return -1;
            if (send(sock, srv.hooks[x].buf, srv.hooks[x].sz, 0) <= 0)
                return -1;
        }
    }

    return 0;
}
/** 
 * send all hook scripts to the given sock, used
 * to send them to newly connected slaves
 *
 * return 0 on success
 **/
send all hook scripts to the given sock, used
to send them to newly connected slaves

return 0 on success
send all hook scripts to the given sock used to send them to newly connected slaves return 0 on success
static int
send_hooks(int sock)
{
    char buf[96];
    int  x;
    int  sz;
    static const char *s[] = {
        "session-complete",
        "cleanup",
    };
    for (x=0; x<NUM_HOOKS; x++) {
        if (srv.hooks[x].sz) {
            sz = sprintf(buf, "HOOK %.32s %d\n",
                    s[x], (int)srv.hooks[x].sz
                    );
            if (send(sock, buf, sz, 0) <= 0)
                return -1;
            if (send(sock, srv.hooks[x].buf, srv.hooks[x].sz, 0) <= 0)
                return -1;
        }
    }
    return 0;
}
static int send_hooks ( int sock ) { char buf [ 96 ] ; int x ; int sz ; static const char * s [ ] = { " " , " " , } ; for ( x = 0 ; x < NUM_HOOKS ; x ++ ) { if ( srv . hooks [ x ] . sz ) { sz = sprintf ( buf , " \n " , s [ x ] , ( int ) srv . hooks [ x ] . sz ) ; if ( send ( sock , buf , sz , 0 ) <= 0 ) return -1 ; if ( send ( sock , srv . hooks [ x ] . buf , srv . hooks [ x ] . sz , 0 ) <= 0 ) return -1 ; } } return 0 ; }
send all hook scripts to the given sock, used
 to send them to newly connected slaves
send all hook scripts to the given sock used to send them to newly connected slaves