Changeset 17


Ignore:
Timestamp:
Nov 6, 2005 7:46:48 PM (19 years ago)
Author:
bennylp
Message:

Tested UDP echo server on Win2K

Location:
pjproject/main/pjlib
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • pjproject/main/pjlib/build/pjlib.dsp

    r12 r17  
    217217 
    218218SOURCE=..\src\pj\ioqueue_select.c 
     219# PROP Exclude_From_Build 1 
    219220# End Source File 
    220221# Begin Source File 
    221222 
    222223SOURCE=..\src\pj\ioqueue_winnt.c 
    223 # PROP Exclude_From_Build 1 
    224224# End Source File 
    225225# Begin Source File 
  • pjproject/main/pjlib/build/pjlib_test.dsp

    r11 r17  
    9696# Begin Source File 
    9797 
    98 SOURCE="..\src\pjlib-test\echo_srv.c" 
    99 # End Source File 
    100 # Begin Source File 
    101  
    10298SOURCE="..\src\pjlib-test\errno.c" 
    10399# End Source File 
  • pjproject/main/pjlib/src/pj/ioqueue_common_abs.c

    r14 r17  
    288288        /* Done. */ 
    289289    } else { 
    290         pj_assert(!"Descriptor is signaled but key " 
    291                    "has no pending operation!"); 
    292  
     290        /* 
     291         * This is normal; execution may fall here when multiple threads 
     292         * are signalled for the same event, but only one thread eventually 
     293         * able to process the event. 
     294         */ 
    293295        pj_mutex_unlock(h->mutex); 
    294296    } 
     
    417419 
    418420    } else { 
     421        /* 
     422         * This is normal; execution may fall here when multiple threads 
     423         * are signalled for the same event, but only one thread eventually 
     424         * able to process the event. 
     425         */ 
    419426        pj_mutex_unlock(h->mutex); 
    420427    } 
     
    617624    write_op = (struct write_operation*)op_key; 
    618625    write_op->op = PJ_IOQUEUE_OP_SEND; 
    619     write_op->buf = NULL; 
     626    write_op->buf = (void*)data; 
    620627    write_op->size = *length; 
    621628    write_op->written = 0; 
     
    695702    write_op = (struct write_operation*)op_key; 
    696703    write_op->op = PJ_IOQUEUE_OP_SEND_TO; 
    697     write_op->buf = NULL; 
     704    write_op->buf = (void*)data; 
    698705    write_op->size = *length; 
    699706    write_op->written = 0; 
  • pjproject/main/pjlib/src/pjlib-test/list.c

    r6 r17  
    3434typedef struct list_node 
    3535{ 
    36     PJ_DECL_LIST_MEMBER(struct list_node) 
     36    PJ_DECL_LIST_MEMBER(struct list_node); 
    3737    int value; 
    3838} list_node; 
  • pjproject/main/pjlib/src/pjlib-test/test.c

    r11 r17  
    133133#if INCLUDE_ECHO_SERVER 
    134134    //echo_server(); 
    135     echo_srv_sync(); 
     135    //echo_srv_sync(); 
     136    udp_echo_srv_ioqueue(); 
     137 
    136138#elif INCLUDE_ECHO_CLIENT 
    137139    if (param_echo_sock_type == 0) 
  • pjproject/main/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c

    r11 r17  
    1515    int                  is_pending; 
    1616    pj_status_t          last_err; 
     17    pj_sockaddr_in       addr; 
     18    int                  addrlen; 
    1719}; 
    1820 
     
    2931 
    3032        if (bytes_received < 0) { 
    31             PJ_LOG(3,("","...error receiving data, received=%d",  
    32                       bytes_received)); 
     33            if (-bytes_received != recv_rec->last_err) { 
     34                recv_rec->last_err = -bytes_received; 
     35                app_perror("...error receiving data", -bytes_received); 
     36            } 
    3337        } else if (bytes_received == 0) { 
    3438            /* note: previous error, or write callback */ 
     
    3943                pj_ssize_t sent = bytes_received; 
    4044                pj_memcpy(send_rec->buffer, recv_rec->buffer, bytes_received); 
    41                 rc = pj_ioqueue_send(key, &send_rec->op_key_,  
    42                                      send_rec->buffer, &sent, 0); 
     45                pj_memcpy(&send_rec->addr, &recv_rec->addr, recv_rec->addrlen); 
     46                send_rec->addrlen = recv_rec->addrlen; 
     47                rc = pj_ioqueue_sendto(key, &send_rec->op_key_,  
     48                                       send_rec->buffer, &sent, 0, 
     49                                       &send_rec->addr, send_rec->addrlen); 
    4350                send_rec->is_pending = (rc==PJ_EPENDING); 
    4451 
    4552                if (rc!=PJ_SUCCESS && rc!=PJ_EPENDING) { 
    46                     app_perror("...send error", rc); 
     53                    app_perror("...send error(1)", rc); 
    4754                } 
    4855            } 
     
    5158        if (!send_rec->is_pending) { 
    5259            bytes_received = recv_rec->size; 
    53             rc = pj_ioqueue_recv(key, &recv_rec->op_key_,  
    54                                  recv_rec->buffer, &bytes_received, 0); 
     60            rc = pj_ioqueue_recvfrom(key, &recv_rec->op_key_,  
     61                                     recv_rec->buffer, &bytes_received, 0, 
     62                                     &recv_rec->addr, &recv_rec->addrlen); 
    5563            recv_rec->is_pending = (rc==PJ_EPENDING); 
    5664            if (rc == PJ_SUCCESS) { 
     
    8189 
    8290    if (bytes_sent <= 0) { 
    83         pj_status_t rc = pj_get_netos_error(); 
    84         app_perror("...send error", rc); 
     91        pj_status_t rc = -bytes_sent; 
     92        if (rc != send_rec->last_err) { 
     93            send_rec->last_err = rc; 
     94            app_perror("...send error(2)", rc); 
     95        } 
    8596    } 
    8697 
     
    102113    read_op.buffer = recv_buf; 
    103114    read_op.size = sizeof(recv_buf); 
     115    read_op.addrlen = sizeof(read_op.addr); 
     116 
    104117    write_op.peer = &read_op; 
    105118    write_op.is_pending = 0; 
     
    109122 
    110123    length = sizeof(recv_buf); 
    111     rc = pj_ioqueue_recv(key, &read_op.op_key_, recv_buf, &length, 0); 
     124    rc = pj_ioqueue_recvfrom(key, &read_op.op_key_, recv_buf, &length, 0, 
     125                             &read_op.addr, &read_op.addrlen); 
    112126    if (rc == PJ_SUCCESS) { 
    113127        read_op.is_pending = 1; 
Note: See TracChangeset for help on using the changeset viewer.