Mercurial > hg > freeDiameter
diff libfdcore/p_psm.c @ 1238:8f9684264fe0
Change management of the p_reqin_count counter to be updated only on routable messages. This should limit the errors in the counter value resulting from rejected or discarded link-local messages.
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Thu, 10 Oct 2013 16:08:46 +0200 |
parents | 8c4dd4b693c6 |
children | 949973661b25 |
line wrap: on
line diff
--- a/libfdcore/p_psm.c Sat Sep 14 12:56:05 2013 +0200 +++ b/libfdcore/p_psm.c Thu Oct 10 16:08:46 2013 +0200 @@ -526,11 +526,6 @@ /* Associate */ CHECK_FCT_DO( fd_msg_answ_associate( msg, req ), goto psm_end ); - } else { - /* Mark the incoming request so that we know we have pending answers for this peer */ - CHECK_POSIX_DO( pthread_mutex_lock(&peer->p_state_mtx), goto psm_end ); - peer->p_reqin_count++; - CHECK_POSIX_DO( pthread_mutex_unlock(&peer->p_state_mtx), goto psm_end ); } /* Log incoming message */ @@ -559,6 +554,13 @@ /* Set the message source and add the Route-Record */ 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); + if ((hdr->msg_flags & CMD_FLAG_REQUEST)) { + /* Mark the incoming request so that we know we have pending answers for this peer */ + CHECK_POSIX_DO( pthread_mutex_lock(&peer->p_state_mtx), goto psm_end ); + peer->p_reqin_count++; + CHECK_POSIX_DO( pthread_mutex_unlock(&peer->p_state_mtx), goto psm_end ); + } + /* Requeue to the global incoming queue */ CHECK_FCT_DO(fd_fifo_post(fd_g_incoming, &msg), goto psm_end ); @@ -600,7 +602,7 @@ } else { if (msg == NULL) { /* Send the error back to the peer */ - CHECK_FCT_DO( ret = fd_out_send(&error, NULL, peer), ); + CHECK_FCT_DO( ret = fd_out_send(&error, NULL, peer, 0), ); if (error) { char buf[256]; /* Only if an error occurred & the message was not saved / dumped */ @@ -654,7 +656,7 @@ CHECK_FCT_DO( fd_msg_rescode_set(msg, "DIAMETER_COMMAND_UNSUPPORTED", "Or maybe the P-bit or application Id are erroneous.", NULL, 1 ), break ); /* Send the answer */ - CHECK_FCT_DO( fd_out_send(&msg, peer->p_cnxctx, peer), break ); + CHECK_FCT_DO( fd_out_send(&msg, peer->p_cnxctx, peer, 0), break ); } while (0); } else { /* We did ASK for it ??? */