MCPcopy Index your code
hub / github.com/F-Stack/f-stack / ng_con_part3

Function ng_con_part3

lib/ff_ng_base.c:1346–1387  ·  view source on GitHub ↗

Composite routines ************************************************************************/ * Connect two nodes using the specified hooks, using queued functions. */

Source from the content-addressed store, hash-verified

1344 * Connect two nodes using the specified hooks, using queued functions.
1345 */
1346static int
1347ng_con_part3(node_p node, item_p item, hook_p hook)
1348{
1349 int error = 0;
1350
1351 /*
1352 * When we run, we know that the node 'node' is locked for us.
1353 * Our caller has a reference on the hook.
1354 * Our caller has a reference on the node.
1355 * (In this case our caller is ng_apply_item() ).
1356 * The peer hook has a reference on the hook.
1357 * We are all set up except for the final call to the node, and
1358 * the clearing of the INVALID flag.
1359 */
1360 if (NG_HOOK_NODE(hook) == &ng_deadnode) {
1361 /*
1362 * The node must have been freed again since we last visited
1363 * here. ng_destry_hook() has this effect but nothing else does.
1364 * We should just release our references and
1365 * free anything we can think of.
1366 * Since we know it's been destroyed, and it's our caller
1367 * that holds the references, just return.
1368 */
1369 ERROUT(ENOENT);
1370 }
1371 if (hook->hk_node->nd_type->connect) {
1372 if ((error = (*hook->hk_node->nd_type->connect) (hook))) {
1373 ng_destroy_hook(hook); /* also zaps peer */
1374 printf("failed in ng_con_part3()\n");
1375 ERROUT(error);
1376 }
1377 }
1378 /*
1379 * XXX this is wrong for SMP. Possibly we need
1380 * to separate out 'create' and 'invalid' flags.
1381 * should only set flags on hooks we have locked under our node.
1382 */
1383 hook->hk_flags &= ~HK_INVALID;
1384done:
1385 NG_FREE_ITEM(item);
1386 return (error);
1387}
1388
1389static int
1390ng_con_part2(node_p node, item_p item, hook_p hook)

Callers

nothing calls this directly

Calls 2

ng_destroy_hookFunction · 0.70
printfFunction · 0.70

Tested by

no test coverage detected