Navigation


Changeset 690:a29e4201d511 in freeDiameter


Ignore:
Timestamp:
Jan 20, 2011, 3:38:12 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

It seems FreeBSD does not unstack cancelation cleanups if we skip the pthread_cleanup_pop call

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/messages.c

    r689 r690  
    22222222#define TEST_ACTION_STOP()                                      \
    22232223        if ((*msg == NULL) || (*action != DISP_ACT_CONT))       \
    2224                 goto no_error;
     2224                goto out;
    22252225
    22262226/* Call all dispatch callbacks for a given message */
     
    22322232        struct avp * avp;
    22332233        struct fd_list * cb_list;
    2234         int ret = 0;
     2234        int ret = 0, r2;
    22352235       
    22362236        TRACE_ENTRY("%p %p %p %p", msg, session, action, error_code);
     
    22462246       
    22472247        /* First, call the DISP_HOW_ANY callbacks */
    2248         CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto error );
     2248        CHECK_FCT_DO( ret = fd_disp_call_cb_int( NULL, msg, NULL, session, action, NULL, NULL, NULL, NULL ), goto out );
    22492249
    22502250        TEST_ACTION_STOP();
    22512251       
    22522252        /* If we don't know the model at this point, we stop cause we cannot get the dictionary. It's invalid: an error should already have been trigged by ANY callbacks */
    2253         CHECK_PARAMS_DO(cmd = (*msg)->msg_model, { ret = EINVAL; goto error; } );
     2253        CHECK_PARAMS_DO(cmd = (*msg)->msg_model, { ret = EINVAL; goto out; } );
    22542254       
    22552255        /* Now resolve message application */
    2256         CHECK_FCT_DO( ret = fd_dict_getdict( cmd, &dict ), goto error );
    2257         CHECK_FCT_DO( ret = fd_dict_search( dict, DICT_APPLICATION, APPLICATION_BY_ID, &(*msg)->msg_public.msg_appl, &app, 0 ), goto error );
     2256        CHECK_FCT_DO( ret = fd_dict_getdict( cmd, &dict ), goto out );
     2257        CHECK_FCT_DO( ret = fd_dict_search( dict, DICT_APPLICATION, APPLICATION_BY_ID, &(*msg)->msg_public.msg_appl, &app, 0 ), goto out );
    22582258       
    22592259        if (app == NULL) {
     
    22672267                        *msg = NULL;
    22682268                }
    2269                 goto no_error;
     2269                goto out;
    22702270        }
    22712271       
    22722272        /* So start browsing the message */
    2273         CHECK_FCT_DO( ret = fd_msg_browse( *msg, MSG_BRW_FIRST_CHILD, &avp, NULL ), goto error );
     2273        CHECK_FCT_DO( ret = fd_msg_browse( *msg, MSG_BRW_FIRST_CHILD, &avp, NULL ), goto out );
    22742274        while (avp != NULL) {
    22752275                /* For unknown AVP, we don't have a callback registered, so just skip */
     
    22782278                       
    22792279                        /* Get the list of callback for this AVP */
    2280                         CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_AVP, avp->avp_model, &cb_list), goto error );
     2280                        CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_AVP, avp->avp_model, &cb_list), goto out );
    22812281                       
    22822282                        /* We search enumerated values only in case of non-grouped AVP */
     
    22842284                                struct dict_object * type;
    22852285                                /* Check if the AVP has a constant value */
    2286                                 CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_TYPE, TYPE_OF_AVP, avp->avp_model, &type, 0), goto error );
     2286                                CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_TYPE, TYPE_OF_AVP, avp->avp_model, &type, 0), goto out );
    22872287                                if (type) {
    22882288                                        struct dict_enumval_request req;
     
    22902290                                        req.type_obj = type;
    22912291                                        memcpy( &req.search.enum_value, avp->avp_public.avp_value, sizeof(union avp_value) );
    2292                                         CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &req, &enumval, 0), goto error );
     2292                                        CHECK_FCT_DO( ret = fd_dict_search(dict, DICT_ENUMVAL, ENUMVAL_BY_STRUCT, &req, &enumval, 0), goto out );
    22932293                                }
    22942294                        }
    22952295                       
    22962296                        /* Call the callbacks */
    2297                         CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto error );
     2297                        CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, avp, session, action, app, cmd, avp->avp_model, enumval ), goto out );
    22982298                        TEST_ACTION_STOP();
    22992299                }
    23002300                /* Go to next AVP */
    2301                 CHECK_FCT_DO(  ret = fd_msg_browse( avp, MSG_BRW_WALK, &avp, NULL ), goto error );
     2301                CHECK_FCT_DO(  ret = fd_msg_browse( avp, MSG_BRW_WALK, &avp, NULL ), goto out );
    23022302        }
    23032303               
    23042304        /* Now call command and application callbacks */
    2305         CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto error );
    2306         CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto error );
     2305        CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_COMMAND, cmd, &cb_list), goto out );
     2306        CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out );
    23072307        TEST_ACTION_STOP();
    23082308       
    23092309        if (app) {
    2310                 CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto error );
    2311                 CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto error );
     2310                CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_APPLICATION, app, &cb_list), goto out );
     2311                CHECK_FCT_DO( ret = fd_disp_call_cb_int( cb_list, msg, NULL, session, action, app, cmd, NULL, NULL ), goto out );
    23122312                TEST_ACTION_STOP();
    23132313        }
    2314        
     2314out:
     2315        ; /* some systems would complain without this */       
    23152316        pthread_cleanup_pop(0);
    23162317       
    2317 no_error:
    2318         CHECK_POSIX(pthread_rwlock_unlock(&fd_disp_lock) );
    2319         return 0;
    2320        
    2321 error:
    2322         CHECK_POSIX_DO(pthread_rwlock_unlock(&fd_disp_lock), /* ignore */ );
    2323         return ret;
    2324 }
    2325 
    2326 
     2318        CHECK_POSIX_DO(r2 = pthread_rwlock_unlock(&fd_disp_lock), /* ignore */ );
     2319        return ret ?: r2;
     2320}
     2321
     2322
  • tests/testappacct.c

    r662 r690  
    260260        /* That's all for the tests yet */
    261261        free(sess_bkp);
    262         fd_ext_fini();
    263262       
    264263        PASSTEST();
Note: See TracChangeset for help on using the changeset viewer.