示例#1
0
int my_socket(int domain, int type, int protocol, int iline, char *pcfile)
{
	int r;
	r = save_socket(domain, type, protocol);
	if (r >= 0) add_fd_list(&g_pfdheader, r, iline, pcfile);
	return r;
}
示例#2
0
int pbntf_got_socket(pubnub_t *pb, pb_socket_t socket)
{
    size_t i = find_pbp(&m_watcher, pb);
    PUBNUB_ASSERT_OPT(i == m_watcher.apb_size);
    if (i == m_watcher.apb_size) {
        save_socket(&m_watcher, pb);
        if (PUBNUB_TIMERS_API) {
            m_watcher.timer_head = pubnub_timer_list_add(m_watcher.timer_head, pb);
        }
    }
    return +1;
}
示例#3
0
int pbntf_got_socket(pubnub_t *pb, pb_socket_t socket)
{
    if (SOCKET_INVALID == socket) {
        return +1;
    }
     
    save_socket(&m_watcher, pb);
    if (PUBNUB_TIMERS_API) {
        m_watcher.timer_head = pubnub_timer_list_add(m_watcher.timer_head, pb);
    }

    return +1;
}
int pbntf_got_socket(pubnub_t *pb, pb_socket_t socket)
{
    EnterCriticalSection(&m_watcher.mutw);

    save_socket(&m_watcher, pb);
    if (PUBNUB_TIMERS_API) {
        m_watcher.timer_head = pubnub_timer_list_add(m_watcher.timer_head, pb);
    }
    pb->options.use_blocking_io = false;
    pbpal_set_blocking_io(pb);
    
    LeaveCriticalSection(&m_watcher.mutw);

    return +1;
}
int pbntf_got_socket(pubnub_t *pb, pb_socket_t socket)
{
    PUBNUB_UNUSED(socket);
    if (pdFALSE == xSemaphoreTakeRecursive(m_watcher.mutw, TICKS_TO_WAIT)) {
        return -1;
    }
     
    save_socket(&m_watcher, pb);
    if (PUBNUB_TIMERS_API) {
        m_watcher.timer_head = pubnub_timer_list_add(m_watcher.timer_head, pb);
    }
    
    xSemaphoreGiveRecursive(m_watcher.mutw);

    xTaskNotifyGive(m_watcher.task);

    return +1;
}