Changeset 1216:581bbd48524a in freeDiameter for libfdcore
- Timestamp:
- Jun 19, 2013, 11:03:24 PM (11 years ago)
- Branch:
- default
- Children:
- 1217:3f7c74ef3787, 1218:152466ff49f8
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/routing_dispatch.c
r1212 r1216 58 58 union { 59 59 int (*rt_fwd_cb)(void * cbdata, struct msg ** msg); 60 int (*rt_out_cb)(void * cbdata, struct msg * msg, struct fd_list * candidates);60 int (*rt_out_cb)(void * cbdata, struct msg ** msg, struct fd_list * candidates); 61 61 }; 62 62 }; … … 135 135 136 136 /* Register a new OUT callback */ 137 int fd_rt_out_register ( int (*rt_out_cb)(void * cbdata, struct msg * 137 int fd_rt_out_register ( int (*rt_out_cb)(void * cbdata, struct msg ** pmsg, struct fd_list * candidates), void * cbdata, int priority, struct fd_rt_out_hdl ** handler ) 138 138 { 139 139 struct rt_hdl * new; … … 189 189 190 190 /* Prevent sending to peers that do not support the message application */ 191 static int dont_send_if_no_common_app(void * cbdata, struct msg * msg, struct fd_list * candidates) 192 { 191 static int dont_send_if_no_common_app(void * cbdata, struct msg ** pmsg, struct fd_list * candidates) 192 { 193 struct msg * msg = *pmsg; 193 194 struct fd_list * li; 194 195 struct msg_hdr * hdr; … … 221 222 222 223 /* Detect if the Destination-Host and Destination-Realm match the peer */ 223 static int score_destination_avp(void * cbdata, struct msg * msg, struct fd_list * candidates) 224 { 224 static int score_destination_avp(void * cbdata, struct msg ** pmsg, struct fd_list * candidates) 225 { 226 struct msg * msg = *pmsg; 225 227 struct fd_list * li; 226 228 struct avp * avp; … … 959 961 960 962 /* We call the cb by reverse priority order */ 961 for ( li = rt_out_list.prev ; li != &rt_out_list; li = li->prev ) {963 for ( li = rt_out_list.prev ; (msgptr != NULL) && (li != &rt_out_list) ; li = li->prev ) { 962 964 struct rt_hdl * rh = (struct rt_hdl *)li; 963 965 964 966 TRACE_DEBUG(ANNOYING, "Calling next OUT callback on %p : %p (prio %d)", msgptr, rh->rt_out_cb, rh->prio); 965 CHECK_FCT_DO( ret = (*rh->rt_out_cb)(rh->cbdata, msgptr, candidates),967 CHECK_FCT_DO( ret = (*rh->rt_out_cb)(rh->cbdata, &msgptr, candidates), 966 968 { 967 969 char buf[256]; … … 971 973 fd_msg_free(msgptr); 972 974 msgptr = NULL; 973 break;974 975 } ); 975 976 } … … 978 979 CHECK_FCT( pthread_rwlock_unlock( &rt_out_lock ) ); 979 980 980 /* If an error occurred , skip to thenext message */981 /* If an error occurred or the callback disposed of the message, go to next message */ 981 982 if (! msgptr) { 982 if (rtd)983 fd_rtd_free(&rtd);984 983 return 0; 985 984 }
Note: See TracChangeset
for help on using the changeset viewer.