From mboxrd@z Thu Jan 1 00:00:00 1970 From: kupcevic@sourceware.org Date: 14 Oct 2006 18:00:05 -0000 Subject: [Cluster-devel] conga/ricci/modules/cluster/clumon/src/daemon ... Message-ID: <20061014180005.32104.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Changes by: kupcevic at sourceware.org 2006-10-14 18:00:02 Modified files: ricci/modules/cluster/clumon/src/daemon: Communicator.cpp Monitor.cpp Peer.cpp main.cpp Log message: modclusterd: exit as soon as possible, after exit signal is caught: - make all sockets non-blocking - make long waits interruptible Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Communicator.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/Peer.cpp.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/daemon/main.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4 --- conga/ricci/modules/cluster/clumon/src/daemon/Communicator.cpp 2006/08/10 22:53:08 1.3 +++ conga/ricci/modules/cluster/clumon/src/daemon/Communicator.cpp 2006/10/14 18:00:02 1.4 @@ -55,6 +55,7 @@ _serv_sock(_port), _delivery_point(delivery_point) { + _serv_sock.nonblocking(true); _connect_time = time_sec(); _rand_state = time_mil(); log(String("Communicator created, port ") + _port, LogCommunicator); @@ -186,7 +187,7 @@ } // process events - for (unsigned int i=0; i::iterator iter = names.begin(); iter != names.end(); --- conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp 2006/10/13 09:36:16 1.8 +++ conga/ricci/modules/cluster/clumon/src/daemon/Monitor.cpp 2006/10/14 18:00:02 1.9 @@ -132,8 +132,12 @@ log(msg, LogTime); // wait some time - struct pollfd nothing; - poll(¬hing, 0, 5000); + for (int i=0; i<10; i++) { + if (shouldStop()) + break; + struct pollfd nothing; + poll(¬hing, 0, 500); + } } log("Stopping communicator", LogCommunicator); _comm.stop(); --- conga/ricci/modules/cluster/clumon/src/daemon/Peer.cpp 2006/08/10 22:53:08 1.2 +++ conga/ricci/modules/cluster/clumon/src/daemon/Peer.cpp 2006/10/14 18:00:02 1.3 @@ -40,14 +40,18 @@ _hostname(hostname), _in(new String()), _out(new String()) -{} +{ + _sock->nonblocking(true); +} Peer::Peer(const String& hostname, unsigned short port) : _sock(new ClientSocket(hostname, port)), _hostname(hostname), _in(new String()), _out(new String()) -{} +{ + _sock->nonblocking(true); +} Peer::~Peer() {} --- conga/ricci/modules/cluster/clumon/src/daemon/main.cpp 2006/10/13 09:36:16 1.3 +++ conga/ricci/modules/cluster/clumon/src/daemon/main.cpp 2006/10/14 18:00:02 1.4 @@ -102,6 +102,7 @@ log("started"); try { ServerSocket server(MONITORING_CLIENT_SOCKET); + server.nonblocking(true); Monitor monitor(COMMUNICATION_PORT); if (!foreground && (geteuid() == 0)) @@ -169,7 +170,7 @@ } // process events - for (unsigned int i=0; i