diff libfdcore/p_sr.c @ 688:8c3dc8584dab

Prepared capability for messages logging to separate files / folders
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 19 Jan 2011 19:05:30 +0900
parents 2e94ef0515d7
children 78b665400097
line wrap: on
line diff
--- a/libfdcore/p_sr.c	Wed Jan 19 17:08:21 2011 +0900
+++ b/libfdcore/p_sr.c	Wed Jan 19 19:05:30 2011 +0900
@@ -108,6 +108,7 @@
 	
 	/* If the callback did not dispose of the message, do it now */
 	if (expired_req) {
+		fd_msg_log(FD_MSG_LOG_DROPPED, expired_req, "Expiration period completed without an answer, and the expiry callback did not dispose of the message.");
 		CHECK_FCT_DO( fd_msg_free(expired_req), /* ignore */ );
 	}
 	
@@ -295,6 +296,7 @@
 		fd_list_unlink(&sr->expire);
 		if (fd_msg_is_routable(sr->req)) {
 			struct msg_hdr * hdr = NULL;
+			int ret;
 			
 			/* Set the 'T' flag */
 			CHECK_FCT_DO(fd_msg_hdr(sr->req, &hdr), /* continue */);
@@ -302,10 +304,14 @@
 				hdr->msg_flags |= CMD_FLAG_RETRANSMIT;
 			
 			/* Requeue for sending to another peer */
-			CHECK_FCT_DO(fd_fifo_post(fd_g_outgoing, &sr->req),
-					CHECK_FCT_DO(fd_msg_free(sr->req), /* What can we do more? */));
+			CHECK_FCT_DO( ret = fd_fifo_post(fd_g_outgoing, &sr->req),
+				{
+					fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Internal error: error while requeuing during failover: %s", strerror(ret) );
+					CHECK_FCT_DO(fd_msg_free(sr->req), /* What can we do more? */)
+				});
 		} else {
-			/* Just free the request... */
+			/* Just free the request. */
+			fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Local message discarded during failover" );
 			CHECK_FCT_DO(fd_msg_free(sr->req), /* Ignore */);
 		}
 		free(sr);
"Welcome to our mercurial repository"