Add ng_send_fn() error handeling inside ng_con_nodes().

Without it some errors may left unnoticed and unhandeled
that will lead to hooks left in half-connected state.

Reviewed by:	julian@
Approved by:	re (kensmith), glebius (mentor)
This commit is contained in:
Alexander Motin 2007-08-18 11:59:17 +00:00
parent 75803d7f94
commit 3fb87c2411

View File

@ -1391,11 +1391,14 @@ ng_con_nodes(node_p node, const char *name, node_p node2, const char *name2)
* Procesing continues in that function in the lock context of
* the other node.
*/
ng_send_fn(node2, hook2, &ng_con_part2, NULL, 0);
if ((error = ng_send_fn(node2, hook2, &ng_con_part2, NULL, 0))) {
printf("failed in ng_con_nodes(): %d\n", error);
ng_destroy_hook(hook); /* also zaps peer */
}
NG_HOOK_UNREF(hook); /* Let each hook go if it wants to */
NG_HOOK_UNREF(hook2);
return (0);
return (error);
}
/*