Re: progress to serveez-0.2

Thien-Thi Nguyen <[email protected]> Sun, 11 Nov 2012 22:11:17 +0100
Newsgroups gmane.network.serveez.devel
Message-ID <[email protected]>
--===============9103733181197399516==
Content-Type: multipart/signed; boundary="==-=-=";
	micalg=pgp-sha1; protocol="application/pgp-signature"

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

() Julian Graham <[email protected]>
() 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
   like:

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

   Is there a less hacky way of disabling that functionality?

Does your code call =E2=80=98svz_updn_all_coservers=E2=80=99?  If so, you c=
an 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):


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=hmm.diff

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

diff --git a/src/libserveez/coserver/coserver.c b/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.
  */
 int
 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)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


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 =E2=80=98guile_entry=E2=80=99 -- 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 =3D svz_server_get ("myserver");
     svz_updn_all_servers (1);
     svz_server_bind (myserver, myportcfg);

Looks reasonable to me.  I see you don't call =E2=80=98svz_updn_all_coserve=
rs=E2=80=99
in this fragment -- are coservers still starting anyway?  (That would be
weird and unexpected and likely-to-segfault, i think.)

=2D-=20
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 ...........

--=-=-=--

--==-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAlCgFHkACgkQZwMiJEyAdQLc4wCgpy+GAizt9dW0oO8BTBx3Wz4/
SPkAoKrHEMpSXHcR4FI3jdokJeok+q6H
=vHWa
-----END PGP SIGNATURE-----
--==-=-=--


--===============9103733181197399516==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
dev-serveez mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dev-serveez

--===============9103733181197399516==--