Esempio n. 1
0
static void
test_event_timeout(SXE_POOL_TCP * pool, void * info)
{
    SXEE6("%s(pool=%s, info=%p)", __func__, SXE_POOL_TCP_GET_NAME(pool), info);
    SXE_UNUSED_ARGUMENT(pool);
    SXE_UNUSED_ARGUMENT(info);
    SXEA1(0, "test_event_timeout should never be called in this test");
    SXER6("return");
}
Esempio n. 2
0
static unsigned
test_sxe_log_buffer_prefix(char * log_buffer, unsigned id, SXE_LOG_LEVEL level)
{
    unsigned length = 0;
    SXE_UNUSED_ARGUMENT(log_buffer);
    SXE_UNUSED_ARGUMENT(id);
    SXE_UNUSED_ARGUMENT(level);
    return length;
}
static void
test_event_timeout(SXE_POOL_TCP * pool, void * info)
{
    SXEE6("%s(pool=%s, info=%p)", __func__, SXE_POOL_TCP_GET_NAME(pool), info);
    SXE_UNUSED_ARGUMENT(pool);
    SXE_UNUSED_ARGUMENT(info);
    tap_ev_push(__func__, 0);
    SXER6("return");
}
static void
test_event_ready_to_write(SXE_POOL_TCP * pool, void * info)
{
    SXE_UNUSED_ARGUMENT(pool);
    SXE_UNUSED_ARGUMENT(info);
    SXEE6("test_event_ready_to_write(pool=%s, info=%p)", SXE_POOL_TCP_GET_NAME(pool), info);
    tap_ev_push(__func__, 0);
    sxe_pool_tcp_write(pool, write_data, strlen(write_data), NULL);
    SXER6("return");
}
Esempio n. 5
0
static void
test_log_line_out_to_stdout(SXE_LOG_LEVEL level, const char * line)
{
    SXE_UNUSED_ARGUMENT(level);
    fputs(line, stdout);
    fflush(stdout);
}
Esempio n. 6
0
static void
sxe_sync_ev_read(EV_P_ ev_io * io, int revents)
{
    SXE_SYNC_EV   * handle;

    SXEE82("sxe_sync_ev_read(io=%p,revents=%d)", io, revents);
#if EV_MULTIPLICITY
    SXE_UNUSED_ARGUMENT(loop);
#endif
    SXE_UNUSED_ARGUMENT(io);
    SXE_UNUSED_ARGUMENT(revents);

    while(recvfrom(sxe_sync_ev_sock, &handle, sizeof(handle), 0, NULL, NULL) == sizeof(handle)) {
        (*sxe_sync_generic_event)(handle, handle->user_data);
    }

    SXEA11(sxe_socket_get_last_error() == SXE_SOCKET_ERROR(EWOULDBLOCK), "Unexpected error receiving from sync socket: %s",
           sxe_socket_get_last_error_as_str());
    SXER80("return");
}
static void
test_event_log_line(SXE_LOG_LEVEL level, const char * line)
{
    unsigned length = strlen(line) - 1;

    SXE_UNUSED_ARGUMENT(level);

    /* Nota bene: You must NOT call anything that logs from this function! */

    /* Catch "TCP pool %s: Connection %u has failed %u times: giving up" messages in the log and send them to the test program.
     */
    if ((sxe_strnstr(&line[38], "TCP pool", length) != NULL) && (sxe_strnstr(&line[38], "times: giving up", length) != NULL)) {
        tap_ev_push(__func__, 1, "line", strdup(&line[39]));
        return;
    }

    fprintf(stderr, "%s\n", line);
}