Changeset 1238:8f9684264fe0 in freeDiameter for libfdcore
- Timestamp:
- Oct 10, 2013, 11:08:46 PM (10 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libfdcore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/fdcore-internal.h
r1207 r1238 297 297 298 298 /* Peer out */ 299 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer );299 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, int update_reqin_cnt); 300 300 int fd_out_start(struct fd_peer * peer); 301 301 int fd_out_stop(struct fd_peer * peer); -
libfdcore/p_ce.c
r1230 r1238 635 635 CHECK_FCT_DO( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, cer, MSGFL_ANSW_ERROR ), goto destroy ); 636 636 CHECK_FCT_DO( fd_msg_rescode_set(*cer, error->pei_errcode, error->pei_message, error->pei_avp, 1 ), goto destroy ); 637 CHECK_FCT_DO( fd_out_send(cer, *recv_cnx, NULL ), goto destroy );637 CHECK_FCT_DO( fd_out_send(cer, *recv_cnx, NULL, 0), goto destroy ); 638 638 639 639 if (error->pei_avp_free) { … … 659 659 /* Send CER on the new connection */ 660 660 CHECK_FCT( create_CER(peer, initiator, &cer) ); 661 CHECK_FCT( fd_out_send(&cer, initiator, peer ) );661 CHECK_FCT( fd_out_send(&cer, initiator, peer, 0) ); 662 662 663 663 /* Are we doing an election ? */ … … 714 714 715 715 /* msg now contains an answer message to send back */ 716 CHECK_FCT_DO( fd_out_send(msg, NULL, peer ), /* In case of error the message has already been dumped */ );716 CHECK_FCT_DO( fd_out_send(msg, NULL, peer, 0), /* In case of error the message has already been dumped */ ); 717 717 } 718 718 … … 943 943 } 944 944 945 /* Update the counter to match with the answer being sent */946 CHECK_POSIX( pthread_mutex_lock(&peer->p_state_mtx) );947 peer->p_reqin_count++;948 CHECK_POSIX( pthread_mutex_unlock(&peer->p_state_mtx) );949 950 945 /* Reply a CEA */ 951 946 CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msg, 0 ) ); … … 956 951 fd_hook_call(HOOK_PEER_CONNECT_SUCCESS, msg, peer, NULL, NULL); 957 952 958 CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer ) );953 CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, 0 ) ); 959 954 960 955 /* Handshake if needed */ -
libfdcore/p_dp.c
r1186 r1238 113 113 CHECK_FCT( fd_peer_get_load_pending(&peer->p_hdr, &to_receive, &to_send) ); 114 114 115 if ((to_receive == 0) && (to_send == 1 /* only the DPA */)) {115 if ((to_receive == 0) && (to_send == 0)) { 116 116 /* No pending exchange, move to CLOSING directly */ 117 117 CHECK_FCT( fd_psm_change_state(peer, STATE_CLOSING) ); 118 118 119 119 /* Now send the DPA */ 120 CHECK_FCT( fd_out_send( msg, NULL, peer ) );120 CHECK_FCT( fd_out_send( msg, NULL, peer, 0) ); 121 121 122 122 /* and move to CLOSED */ … … 132 132 133 133 /* Now send the DPA */ 134 CHECK_FCT( fd_out_send( msg, NULL, peer ) );134 CHECK_FCT( fd_out_send( msg, NULL, peer, 0) ); 135 135 } 136 136 } else { … … 202 202 203 203 /* Now send the DPR message */ 204 CHECK_FCT_DO( fd_out_send(&msg, NULL, peer ), /* ignore since we are on timeout anyway */ );204 CHECK_FCT_DO( fd_out_send(&msg, NULL, peer, 0), /* ignore since we are on timeout anyway */ ); 205 205 206 206 return 0; -
libfdcore/p_dw.c
r1186 r1238 83 83 84 84 /* Now send this message */ 85 CHECK_FCT( fd_out_send(&msg, NULL, peer ) );85 CHECK_FCT( fd_out_send(&msg, NULL, peer, 0) ); 86 86 87 87 /* And mark the pending DW */ … … 106 106 CHECK_FCT( fd_msg_rescode_set( *msg, "DIAMETER_SUCCESS", NULL, NULL, 0 ) ); 107 107 CHECK_FCT( fd_msg_add_origin ( *msg, 1 ) ); 108 CHECK_FCT( fd_out_send( msg, peer->p_cnxctx, peer ) );108 CHECK_FCT( fd_out_send( msg, peer->p_cnxctx, peer, 0) ); 109 109 110 110 } else { -
libfdcore/p_out.c
r1207 r1238 160 160 161 161 /* Wrapper to sending a message either by out thread (peer in OPEN state) or directly; cnx or peer must be provided. Flags are valid only for direct sending, not through thread (unused) */ 162 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer )162 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, int update_reqin_cnt) 163 163 { 164 164 struct msg_hdr * hdr; … … 167 167 CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx))); 168 168 169 if ( peer) {169 if (update_reqin_cnt && peer) { 170 170 CHECK_FCT( fd_msg_hdr(*msg, &hdr) ); 171 171 if (!(hdr->msg_flags & CMD_FLAG_REQUEST)) { -
libfdcore/p_psm.c
r1198 r1238 527 527 CHECK_FCT_DO( fd_msg_answ_associate( msg, req ), goto psm_end ); 528 528 529 } else {530 /* Mark the incoming request so that we know we have pending answers for this peer */531 CHECK_POSIX_DO( pthread_mutex_lock(&peer->p_state_mtx), goto psm_end );532 peer->p_reqin_count++;533 CHECK_POSIX_DO( pthread_mutex_unlock(&peer->p_state_mtx), goto psm_end );534 529 } 535 530 … … 560 555 CHECK_FCT_DO( fd_msg_source_setrr( msg, peer->p_hdr.info.pi_diamid, peer->p_hdr.info.pi_diamidlen, fd_g_config->cnf_dict ), goto psm_end); 561 556 557 if ((hdr->msg_flags & CMD_FLAG_REQUEST)) { 558 /* Mark the incoming request so that we know we have pending answers for this peer */ 559 CHECK_POSIX_DO( pthread_mutex_lock(&peer->p_state_mtx), goto psm_end ); 560 peer->p_reqin_count++; 561 CHECK_POSIX_DO( pthread_mutex_unlock(&peer->p_state_mtx), goto psm_end ); 562 } 563 562 564 /* Requeue to the global incoming queue */ 563 565 CHECK_FCT_DO(fd_fifo_post(fd_g_incoming, &msg), goto psm_end ); … … 601 603 if (msg == NULL) { 602 604 /* Send the error back to the peer */ 603 CHECK_FCT_DO( ret = fd_out_send(&error, NULL, peer ), );605 CHECK_FCT_DO( ret = fd_out_send(&error, NULL, peer, 0), ); 604 606 if (error) { 605 607 char buf[256]; … … 655 657 656 658 /* Send the answer */ 657 CHECK_FCT_DO( fd_out_send(&msg, peer->p_cnxctx, peer ), break );659 CHECK_FCT_DO( fd_out_send(&msg, peer->p_cnxctx, peer, 0), break ); 658 660 } while (0); 659 661 } else { -
libfdcore/p_sr.c
r1232 r1238 337 337 /* The list of expiring requests must be empty now */ 338 338 ASSERT( FD_IS_LIST_EMPTY(&srlist->exp) ); 339 ASSERT( srlist->cnt == 0 ); /* debug the counter management if needed */ 339 340 340 341 CHECK_POSIX_DO( pthread_mutex_unlock(&srlist->mtx), /* continue anyway */ ); -
libfdcore/peers.c
r1207 r1238 550 550 fd_hook_call(HOOK_PEER_CONNECT_FAILED, *cer, NULL, "Received CER with invalid Origin-Host AVP", NULL); 551 551 552 CHECK_FCT( fd_out_send(cer, *cnx, NULL ) );552 CHECK_FCT( fd_out_send(cer, *cnx, NULL, 0) ); 553 553 return EINVAL; 554 554 } -
libfdcore/routing_dispatch.c
r1230 r1238 415 415 CHECK_FCT( fd_fifo_post(fd_g_incoming, pmsg) ); 416 416 } else { 417 CHECK_FCT( fd_out_send(pmsg, NULL, peer ) );417 CHECK_FCT( fd_out_send(pmsg, NULL, peer, 1) ); 418 418 } 419 419 … … 893 893 894 894 /* Push the message into this peer */ 895 CHECK_FCT( fd_out_send(&msgptr, NULL, peer ) );895 CHECK_FCT( fd_out_send(&msgptr, NULL, peer, 1) ); 896 896 897 897 /* We're done with this answer */ … … 1008 1008 if (fd_peer_getstate(peer) == STATE_OPEN) { 1009 1009 /* Send to this one */ 1010 CHECK_FCT_DO( fd_out_send(&msgptr, NULL, peer ), continue );1010 CHECK_FCT_DO( fd_out_send(&msgptr, NULL, peer, 1), continue ); 1011 1011 1012 1012 /* If the sending was successful */
Note: See TracChangeset
for help on using the changeset viewer.