Ignore:
Timestamp:
Jan 30, 2006 6:40:05 PM (18 years ago)
Author:
bennylp
Message:

Finished implementation of UA layer (to be tested)

File:
1 edited

Legend:

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

    r123 r127  
    6262        PJSIP_MOD_PRIORITY_TSX_LAYER,   /* Priority.                */ 
    6363        NULL,                           /* User_data.               */ 
    64         0,                              /* Methods count.           */ 
    65         { NULL },                       /* Array of methods.        */ 
    6664        mod_tsx_layer_load,             /* load().                  */ 
    6765        mod_tsx_layer_start,            /* start()                  */ 
     
    508506 
    509507    /* Check if no transaction with the same key exists. */ 
    510     if (pj_hash_get( mod_tsx_layer.htable, &tsx->transaction_key.ptr, 
    511                      tsx->transaction_key.slen) != NULL) 
    512     { 
    513         pj_mutex_unlock(mod_tsx_layer.mutex); 
    514         return PJ_EEXISTS; 
    515     } 
     508    PJ_ASSERT_ON_FAIL(pj_hash_get( mod_tsx_layer.htable,  
     509                                   &tsx->transaction_key.ptr, 
     510                                   tsx->transaction_key.slen,  
     511                                   &tsx->hashed_key) == NULL, 
     512                        { 
     513                            pj_mutex_unlock(mod_tsx_layer.mutex); 
     514                            return PJ_EEXISTS; 
     515                        } 
     516                      ); 
    516517 
    517518    /* Register the transaction to the hash table. */ 
    518519    pj_hash_set( tsx->pool, mod_tsx_layer.htable, tsx->transaction_key.ptr, 
    519                  tsx->transaction_key.slen, tsx); 
     520                 tsx->transaction_key.slen, tsx->hashed_key, tsx); 
    520521 
    521522    /* Unlock mutex. */ 
     
    539540    /* Register the transaction to the hash table. */ 
    540541    pj_hash_set( NULL, mod_tsx_layer.htable, tsx->transaction_key.ptr, 
    541                  tsx->transaction_key.slen, NULL); 
     542                 tsx->transaction_key.slen, tsx->hashed_key, NULL); 
    542543 
    543544    /* Unlock mutex. */ 
     
    555556 
    556557    pj_mutex_lock(mod_tsx_layer.mutex); 
    557     tsx = pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen ); 
     558    tsx = pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, NULL ); 
    558559    pj_mutex_unlock(mod_tsx_layer.mutex); 
    559560 
     
    649650    pj_mutex_lock( mod_tsx_layer.mutex ); 
    650651 
    651     tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen ); 
     652    tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, NULL ); 
    652653 
    653654    if (tsx == NULL || tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     
    690691    pj_mutex_lock( mod_tsx_layer.mutex ); 
    691692 
    692     tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen ); 
     693    tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, NULL ); 
    693694 
    694695    if (tsx == NULL || tsx->state == PJSIP_TSX_STATE_TERMINATED) { 
     
    10361037                         &via->branch_param); 
    10371038 
     1039    /* Calculate hashed key value. */ 
     1040    tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 
     1041                                   tsx->transaction_key.slen); 
     1042 
    10381043    PJ_LOG(6, (tsx->obj_name, "tsx_key=%.*s", tsx->transaction_key.slen, 
    10391044               tsx->transaction_key.ptr)); 
     
    11411146    } 
    11421147 
     1148    /* Calculate hashed key value. */ 
     1149    tsx->hashed_key = pj_hash_calc(0, tsx->transaction_key.ptr, 
     1150                                   tsx->transaction_key.slen); 
     1151 
    11431152    /* Duplicate branch parameter for transaction. */ 
    11441153    branch = &rdata->msg_info.via->branch_param; 
     
    11791188        return status; 
    11801189    } 
     1190 
     1191    /* Put this transaction in rdata's mod_data. */ 
     1192    rdata->endpt_info.mod_data[mod_tsx_layer.mod.id] = tsx; 
    11811193 
    11821194    /* Unlock transaction and return. */ 
Note: See TracChangeset for help on using the changeset viewer.