NgAllocRecvMsg() hangs

Вадим Уразаев tretuliy2 at gmail.com
Tue Sep 25 14:12:07 UTC 2012


Hi all.
I don`t know if it`s write place to write, sorry if it`s not.

I am trying to write some application that uses netgraph framework, and
stuck on getting information from ng_ksocket node.
It is server ng_ksocket node that clones itself on each connection
(client), I get this cloned nodes id (something like [4ab]:) and store it
in array.
I want from time to time check if somebody connected to each of this nodes,
and for that I am trying to use something like that :
if (NgSendMsg(csock, pth, NGM_KSOCKET_COOKIE, NGM_KSOCKET_GETPEERNAME,
NULL, 0) == -1) {
if  (errno == ENOTCONN) {
syslog(LOG_INFO, "check_and_clear(): Socket not connected, node: %s will be
shutdown", pth);
ShutNode(pth);
memset(clients[i], 0, sizeof(clients[i]));
} else if (errno == ENOENT) {
syslog(LOG_NOTICE, "check_and_clear(): Node already closed %s", pth);
memset(clients[i], 0, sizeof(clients[i]));
} else {
syslog(LOG_ERR, "check_and_clear(): An error has occured while getpeername
from node: %s, %s", pth, strerror(errno));
}
}


More information about the freebsd-hackers mailing list