# HG changeset patch # User Sebastien Decugis # Date 1371183572 -28800 # Node ID d2608e47db28427ea9b38c89a12bda073c207e8b # Parent ce2b00dc86c1e48828b174841ee01ba5c41dca77 Fix issue that can trigger an assert when failover occurs diff -r ce2b00dc86c1 -r d2608e47db28 libfdcore/peers.c --- a/libfdcore/peers.c Fri Jun 14 10:14:11 2013 +0800 +++ b/libfdcore/peers.c Fri Jun 14 12:19:32 2013 +0800 @@ -241,13 +241,20 @@ /* Requeue all messages in the "out" queue */ while ( fd_fifo_tryget(peer->p_tosend, &m) == 0 ) { - fd_hook_call(HOOK_MESSAGE_FAILOVER, m, peer, NULL, fd_msg_pmdl_get(m)); - CHECK_FCT_DO(fd_fifo_post_noblock(fd_g_outgoing, (void *)&m), - { - /* fallback: destroy the message */ - fd_hook_call(HOOK_MESSAGE_DROPPED, m, NULL, "Internal error: unable to requeue this message during failover process", fd_msg_pmdl_get(m)); - CHECK_FCT_DO(fd_msg_free(m), /* What can we do more? */) - } ); + /* but only if they are routable */ + if (fd_msg_is_routable(m)) { + fd_hook_call(HOOK_MESSAGE_FAILOVER, m, peer, NULL, fd_msg_pmdl_get(m)); + CHECK_FCT_DO(fd_fifo_post_noblock(fd_g_outgoing, (void *)&m), + { + /* fallback: destroy the message */ + fd_hook_call(HOOK_MESSAGE_DROPPED, m, NULL, "Internal error: unable to requeue this message during failover process", fd_msg_pmdl_get(m)); + CHECK_FCT_DO(fd_msg_free(m), /* What can we do more? */) + } ); + } else { + /* Just free it */ + /* fd_hook_call(HOOK_MESSAGE_DROPPED, m, NULL, "Non-routable message freed during handover", fd_msg_pmdl_get(m)); */ + CHECK_FCT_DO(fd_msg_free(m), /* What can we do more? */) + } } /* Requeue all routable sent requests */