Ejemplo n.º 1
0
int tbx_ns_chksum_write_flush(tbx_ns_t *ns)
{
    char chksum_value[CHKSUM_MAX_SIZE];
    int err, n;
    tbx_tbuf_t buf;

    log_printf(15, "ns_write_chksum_flush: injecting chksum!  ns=%d type=%d bytesleft=" I64T " bsize=" I64T "\n",
               tbx_ns_getid(ns), tbx_chksum_type(&(ns->write_chksum.chksum)), ns->write_chksum.bytesleft, ns->write_chksum.blocksize);
    tbx_log_flush();

    if (ns_write_chksum_state(ns) == 0) return(0);
    if (ns->write_chksum.bytesleft == ns->write_chksum.blocksize) return(0);  //** Nothing to do

    n = tbx_chksum_size(&(ns->write_chksum.chksum), CHKSUM_DIGEST_HEX);
    tbx_chksum_get(&(ns->write_chksum.chksum), CHKSUM_DIGEST_HEX, chksum_value);

    ns->write_chksum.is_running = 0;  //** Don't want to get in an endless loop
    tbx_tbuf_single(&buf, n, chksum_value);
    err = _write_netstream_block(ns, apr_time_now() + apr_time_make(5,0), &buf, 0, n, 0);
    ns->write_chksum.is_running = 1;

    if (err != 0) {
        log_printf(10, "ns_write_chksum_flush: ns=%d Error writing chksum! error=%d\n", tbx_ns_getid(ns), err);
        return(err);
    }

    chksum_value[n] = '\0';
    log_printf(15, "ns_write_chksum_flush: ns=%d chksum_value=%s\n", tbx_ns_getid(ns), chksum_value);
    log_printf(15, "ns_write_chksum_flush: end of routine!  ns=%d\n err=%d", tbx_ns_getid(ns), err);
    tbx_log_flush();

    return(err);
}
Ejemplo n.º 2
0
int write_netstream_block(tbx_ns_t *ns, apr_time_t end_time, tbx_tbuf_t *buffer, unsigned int boff, int bsize)
{
    return(_write_netstream_block(ns, end_time, buffer, boff, bsize, 1));
}
Ejemplo n.º 3
0
int write_netstream_block(NetStream_t *ns, apr_time_t end_time, tbuffer_t *buffer, int boff, int bsize)
{
    return(_write_netstream_block(ns, end_time, buffer, boff, bsize, 1));
}