From: fabbione@sourceware.org <fabbione@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/cman/lib libcman.c libcman.h
Date: 5 Nov 2007 16:43:50 -0000 [thread overview]
Message-ID: <20071105164350.19089.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at sourceware.org 2007-11-05 16:43:50
Modified files:
cman/lib : libcman.c libcman.h
Log message:
Add cman_wait_init as wrapper for cman_admin_init/cman_init and cman_is_quorate
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.c.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.35&r2=1.36
--- cluster/cman/lib/libcman.c 2007/09/18 15:34:41 1.37
+++ cluster/cman/lib/libcman.c 2007/11/05 16:43:50 1.38
@@ -354,6 +354,61 @@
return open_socket(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), privdata);
}
+/* cman_wait_init
+ *
+ * @admin: set to 0 for standard socket, != 0 for admin socket
+ * @ctimeout: connection timeout in second to attempt to connect to cman.
+ * 0 = wait forever, -1 = do not wait.
+ * @qtimeout: cluster quorum timeout in second.
+ * 0 = wait forever, -1 = do not wait.
+ * @privdata: see cman_admin_init and cman_init.
+ */
+
+cman_handle_t cman_wait_init(int admin, int ctimeout, int qtimeout, void *privdata)
+{
+ cman_handle_t ch;
+ int i = 0;
+
+ if (!ctimeout)
+ i = 1;
+
+ while (ctimeout != i) {
+
+ if (admin) {
+ ch = cman_admin_init(privdata);
+ } else {
+ ch = cman_init(privdata);
+ }
+
+ if ((ch) || (ctimeout = -1)) {
+ i = ctimeout;
+ } else {
+ sleep(1);
+ i++;
+ }
+ }
+
+ if (!ch)
+ return ch;
+
+ if (!qtimeout) {
+ i = 1;
+ } else {
+ i = 0;
+ }
+
+ while (qtimeout != i) {
+ if ((cman_is_quorate(ch)) || (qtimeout = -1)) {
+ i = qtimeout;
+ } else {
+ sleep(1);
+ i++;
+ }
+ }
+
+ return ch;
+}
+
int cman_finish(cman_handle_t handle)
{
struct cman_handle *h = (struct cman_handle *)handle;
--- cluster/cman/lib/libcman.h 2007/11/05 15:15:53 1.35
+++ cluster/cman/lib/libcman.h 2007/11/05 16:43:50 1.36
@@ -203,6 +203,7 @@
*/
cman_handle_t cman_init(void *privdata);
cman_handle_t cman_admin_init(void *privdata);
+cman_handle_t cman_wait_init(int admin, int ctimeout, int qtimeout, void *privdata);
int cman_finish(cman_handle_t handle);
/* Update/retrieve the private data */
next reply other threads:[~2007-11-05 16:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-05 16:43 fabbione [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-11-09 12:51 [Cluster-devel] cluster/cman/lib libcman.c libcman.h fabbione
2007-05-02 10:27 pcaulfield
2006-07-11 8:13 pcaulfield
2006-07-11 19:57 ` Lon Hohberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071105164350.19089.qmail@sourceware.org \
--to=fabbione@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.