STCP/mysock_api.c
int mylisten(mysocket_t sd, int backlog)
{
    mysock_context_t *ctx = _mysock_get_context(sd);

    assert(ctx->bound);

    MYSOCK_CHECK(ctx != NULL, EBADF);
    MYSOCK_CHECK(ctx->bound, EINVAL);

    /* set up the socket for demultiplexing */
    ctx->listening = TRUE;
    _mysock_set_backlog(ctx, backlog);

    if (_network_listen(&ctx->network_state, backlog) < 0)
        return -1;

    /* since we don't spawn an STCP worker thread for passive sockets
     * (there's no transport layer related work to do, so
     * _mysock_transport_init() is never called for such sockets), we
     * begin receiving network packets here...
     */
    if (_network_start_recv_thread(ctx) < 0)
    {
        assert(0);
        return -1;
    }

    return 0;
}
/* in this implementation, mylisten() is assumed to follow mybind() */
in this implementation, mylisten() is assumed to follow mybind()
in this implementation mylisten () is assumed to follow mybind ()
int mylisten(mysocket_t sd, int backlog)
{
    mysock_context_t *ctx = _mysock_get_context(sd);
    assert(ctx->bound);
    MYSOCK_CHECK(ctx != NULL, EBADF);
    MYSOCK_CHECK(ctx->bound, EINVAL);
    ctx->listening = TRUE;
    _mysock_set_backlog(ctx, backlog);
    if (_network_listen(&ctx->network_state, backlog) < 0)
        return -1;
    if (_network_start_recv_thread(ctx) < 0)
    {
        assert(0);
        return -1;
    }
    return 0;
}
int mylisten ( mysocket_t sd , int backlog ) { mysock_context_t * ctx = _mysock_get_context ( sd ) ; assert ( ctx -> bound ) ; MYSOCK_CHECK ( ctx != NULL , EBADF ) ; MYSOCK_CHECK ( ctx -> bound , EINVAL ) ; ctx -> listening = TRUE ; _mysock_set_backlog ( ctx , backlog ) ; if ( _network_listen ( & ctx -> network_state , backlog ) < 0 ) return -1 ; if ( _network_start_recv_thread ( ctx ) < 0 ) { assert ( 0 ) ; return -1 ; } return 0 ; }
in this implementation, mylisten() is assumed to follow mybind()
in this implementation mylisten () is assumed to follow mybind ()
/* set up the socket for demultiplexing */ /* since we don't spawn an STCP worker thread for passive sockets
     * (there's no transport layer related work to do, so
     * _mysock_transport_init() is never called for such sockets), we
     * begin receiving network packets here...
     */