Communicating children

I’ve been working on getting children listeners talking with the parent listener today.  I added a few new defines to the exit conditions header to facilitate their communication.  When a child exits,it now sends a message through the pipe to the parent.  Whenever the parent receives a new connection, before it checks if it can handle another connection, it looks to see if there is anything to read from the child.  If it reads an indication that a child finished, it removes that child’s pid file and decrements the _numConnected counter.  the parent will also ping the children it did not receive a termination indication from to make sure it is still alive.  I haven’t quite finished working out the details of the ping, mainly because I don’t know how long it might take for the child to respond and I am hesitant to have it block there while waiting for a ping response.  I might decide to have it send the ping out when it receives a connection and look for that ping the next time it receives a connection in the hopes that the child will have had a chance to respond to the ping by then.  I really just don’t know how long it might take a child to execute a command for the client, which is what dictates how long it would take for the child to respond to the ping.

Advertisements

~ by chambj2 on November 16, 2010.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: