comparison libfdcore/p_out.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 043b894b0511
children 035f489b845b
comparison
equal deleted inserted replaced
1236:a0d9fb49694e 1238:8f9684264fe0
157 CHECK_FCT_DO( fd_event_send(peer->p_events, FDEVP_CNX_ERROR, 0, NULL), /* What do we do if it fails? */ ); 157 CHECK_FCT_DO( fd_event_send(peer->p_events, FDEVP_CNX_ERROR, 0, NULL), /* What do we do if it fails? */ );
158 return NULL; 158 return NULL;
159 } 159 }
160 160
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) */ 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 struct msg_hdr * hdr; 164 struct msg_hdr * hdr;
165 165
166 TRACE_ENTRY("%p %p %p", msg, cnx, peer); 166 TRACE_ENTRY("%p %p %p", msg, cnx, peer);
167 CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx))); 167 CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx)));
168 168
169 if (peer) { 169 if (update_reqin_cnt && peer) {
170 CHECK_FCT( fd_msg_hdr(*msg, &hdr) ); 170 CHECK_FCT( fd_msg_hdr(*msg, &hdr) );
171 if (!(hdr->msg_flags & CMD_FLAG_REQUEST)) { 171 if (!(hdr->msg_flags & CMD_FLAG_REQUEST)) {
172 /* Update the count of pending answers to send */ 172 /* Update the count of pending answers to send */
173 CHECK_POSIX( pthread_mutex_lock(&peer->p_state_mtx) ); 173 CHECK_POSIX( pthread_mutex_lock(&peer->p_state_mtx) );
174 peer->p_reqin_count--; 174 peer->p_reqin_count--;
"Welcome to our mercurial repository"