Changeset 852


Ignore:
Timestamp:
Dec 11, 2006 9:32:57 AM (18 years ago)
Author:
bennylp
Message:

More testing with TLS implementation (ticket #3), we can send outgoing request but somehow connection gets closed by server after the request is sent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_tls_ossl.c

    r849 r852  
    163163}; 
    164164 
     165static int ssl_print_err_count; 
    165166static int ssl_print_err_cb(const char *str, size_t len, void *u) 
    166167{ 
     
    180181        break; 
    181182    } 
     183    ++ssl_print_err_count; 
    182184    return len; 
    183185} 
     
    186188{ 
    187189    struct err_data e; 
     190    int count = ssl_print_err_count; 
    188191    e.lvl = level; e.snd = sender; e.ttl = title; 
    189192    ERR_print_errors_cb(&ssl_print_err_cb, &e); 
    190     ERR_print_errors_fp(stderr); 
     193 
     194    if (count==ssl_print_err_count) 
     195        ssl_print_err_cb(" ", 1, &e); 
    191196} 
    192197#else 
     
    529534 
    530535        case SSL_ERROR_ZERO_RETURN: 
     536            PJ_LOG(4,(tls_tp->base.obj_name, "SSL transport shutdodwn by remote")); 
    531537            pjsip_transport_shutdown(&tls_tp->base); 
    532538            goto done; 
     
    678684 
    679685    /* Initialize local address */ 
     686    tls_tp->base.addr_len = sizeof(tls_tp->base.local_addr); 
    680687    status = pj_sock_getsockname(tls_tp->sock, &tls_tp->base.local_addr, 
    681688                                 &tls_tp->base.addr_len); 
     
    713720    tls_tp->rdata.pkt_info.src_port = pj_ntohs(rem_addr->sin_port); 
    714721 
     722    /* Register transport to transport manager */ 
     723    status = pjsip_transport_register(lis->tpmgr, &tls_tp->base); 
     724    if (status != PJ_SUCCESS) { 
     725        goto on_error; 
     726    } 
     727 
    715728    /* Create worker thread to receive packets */ 
    716729    status = pj_thread_create(pool, "tlsthread", &tls_worker_thread, 
    717730                              tls_tp, PJ_THREAD_DEFAULT_STACK_SIZE, 0,  
    718731                              &tls_tp->thread); 
    719     if (status != PJ_SUCCESS) 
    720         goto on_error; 
     732    if (status != PJ_SUCCESS) { 
     733        pjsip_transport_destroy(&tls_tp->base); 
     734        return status; 
     735    } 
    721736 
    722737    /* Done */ 
     
    855870static pj_status_t tls_tp_do_shutdown(pjsip_transport *transport) 
    856871{ 
     872    PJ_LOG(4,(transport->obj_name, "TLS transport marked for shutdown..")); 
     873 
    857874    /* Nothing to do for TLS */ 
    858875    PJ_UNUSED_ARG(transport); 
     876 
    859877    return PJ_SUCCESS; 
    860878} 
     
    866884{ 
    867885    struct tls_transport *tls_tp = (struct tls_transport*) transport; 
     886 
     887    PJ_LOG(4,(transport->obj_name, "Destroying TLS transport..")); 
    868888 
    869889    if (tls_tp->thread) { 
     
    910930    } 
    911931 
     932    PJ_LOG(4,(THIS_FILE, "TLS transport destroyed")); 
    912933    return PJ_SUCCESS; 
    913934} 
Note: See TracChangeset for help on using the changeset viewer.