[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [dev-serveez] progress to serveez-0.2

From: Thien-Thi Nguyen
Subject: Re: [dev-serveez] progress to serveez-0.2
Date: Sun, 11 Nov 2012 22:11:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

() Julian Graham <address@hidden>
() Sat, 10 Nov 2012 18:17:54 -0500

   Sorry, that should be "svz_coservertypes." Now that I'm sifting
   through my own code again, the threads are coming back to me: I was
   trying to come up with a way to prevent the four-or-so coserver child
   processes from starting up, since the program I was linking with
   libserveez didn't need them and they were complicating some process
   control I was trying to do. So I had a block of code that looked

     for (; i < MAX_COSERVER_TYPES; i++)
       svz_coservertypes[i].instances = 0;

   Is there a less hacky way of disabling that functionality?

Does your code call ‘svz_updn_all_coservers’?  If so, you can try
omitting all calls (both the up and the down) and see how that flies.
(Ignorance is bliss.)  If there are still problems, try this patch (to

 src/libserveez/coserver/coserver.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/libserveez/coserver/coserver.c 
index 9e28a1f..be4fd32 100644
--- a/src/libserveez/coserver/coserver.c
+++ b/src/libserveez/coserver/coserver.c
@@ -1177,10 +1177,21 @@ svz_coserver_finalize (void)
  * If @var{direction} is non-zero, init coserver internals.
  * Otherwise, finalize them.  Return 0 if successful.
+ *
+ * If @var{direction} is positive, init also starts one instance each
+ * of the builtin servers.  If negative, it doesn't.
 svz_updn_all_coservers (int direction)
+  if (0 > direction)
+    {
+      int i;
+      for (i = 0; n < SVZ_MAX_COSERVER_TYPES; i++)
+        svz_coservertypes[i].instances = 0;
+    }
   return (direction
           ? svz_coserver_init
           : svz_coserver_finalize)
and on the initial (up) call, specify DIRECTION as -1.  Ideally the
patch would not be necessary (because then i need to also add support
for serveez (the program) to take some kind of config (command-line?,
file-based?) specifying "no coserver instances" and propagate that down
to ‘guile_entry’ -- IOW, a bit messy).

   Okay. I think I've found alternate invocations that achieve the same
   result as the functions I was using. I appreciate that this stuff is
   exposed via Guile -- and my application /does/ use Guile quite heavily
   -- but for reasons of code organization, I'd like to set up my server
   sockets in C, not Scheme. Can you tell me if the following looks like
   a reasonable use of libserveez's API? (It seems to work, FWIW.)

     svz_servertype_add (&myservertype);
     svz_config_type_instantiate ("server", "myservertype", "myserver",
                                  NULL, NULL, 0, NULL);
     my_server = svz_server_get ("myserver");
     svz_updn_all_servers (1);
     svz_server_bind (myserver, myportcfg);

Looks reasonable to me.  I see you don't call ‘svz_updn_all_coservers’
in this fragment -- are coservers still starting anyway?  (That would be
weird and unexpected and likely-to-segfault, i think.)

Thien-Thi Nguyen ..................................... GPG key: 4C807502
.                  NB: ttn at glug dot org is not me                   .
.                 (and has not been since 2007 or so)                  .
.                        ACCEPT NO SUBSTITUTES                         .
........... please send technical questions to mailing lists ...........

Attachment: pgpe__oBBaxZH.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]