diff libfdcore/p_sr.c @ 1240:0420ccc4671a

Add a counter for the sent requests for which we did not wait for an answer. It might be relevant this value contributes to the load estimate of the remote peer, but it is not very reliable
author Sebastien Decugis <sdecugis@freediameter.net>
date Thu, 10 Oct 2013 16:30:55 +0200
parents b059b9e8ef83
children c9a160b815ea
line wrap: on
line diff
--- a/libfdcore/p_sr.c	Thu Oct 10 16:19:23 2013 +0200
+++ b/libfdcore/p_sr.c	Thu Oct 10 16:30:55 2013 +0200
@@ -163,6 +163,7 @@
 		/* Free the sentreq information */
 		fd_list_unlink(&first->chain);
 		srlist->cnt--;
+		srlist->cnt_lost++; /* We are not waiting for this answer anymore, but the remote peer may still be processing it. */
 		fd_list_unlink(&first->expire);
 		free(first);
 		
@@ -279,6 +280,9 @@
 		TRACE_DEBUG(INFO, "There is no saved request with this hop-by-hop id (%x)", hbh);
 		srl_dump("Current list of SR: ", &srlist->srs);
 		*req = NULL;
+		if (srlist->cnt_lost > 0) {
+			srlist->cnt_lost--; /* This is probably an answer for a request we already timedout. */
+		} /* else, probably a bug in the remote peer */
 	} else {
 		/* Restore hop-by-hop id */
 		*((uint32_t *)sr->chain.o) = sr->prevhbh;
"Welcome to our mercurial repository"