Ilja,

I have a small patch that may well fix bug #799100

https://sourceforge.net/tracker/?func=detail&atid=577642&aid=799100&group_id=85894

The general reasoning is
- other daemons can do, so should dbmail
- this must be solved in libc already

So I ended up trying SO_LINGER and lo-and-behold it appears to do the trick.

I have zero+ experience in C network programming so any takers for critique, shoot.

I've done some testing and I'm unable to reproduce the problem when
the patch is applied.





--
  ________________________________________________________________
  Paul Stevens                                  mailto:[EMAIL PROTECTED]
  NET FACILITIES GROUP                     PGP: finger [EMAIL PROTECTED]
  The Netherlands________________________________http://www.nfg.nl
--- dbmail-1.2.orig/server.c    2003-10-13 16:06:17.000000000 +0200
+++ dbmail-1.2/server.c 2003-10-13 16:08:11.000000000 +0200
@@ -249,7 +249,13 @@
 
   /* set socket option: reuse address */
   setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &so_reuseaddress, 
sizeof(so_reuseaddress));
-
+  
+  /* how to handle connected clients in case of a shutdown */
+  struct linger so_linger;
+  so_linger.l_onoff = 1;
+  so_linger.l_linger = 5;
+  setsockopt(sock, SOL_SOCKET, SO_LINGER, &so_linger, sizeof(so_linger));
+               
   /* bind the address */
   len = sizeof(saServer);
   r = bind(sock, (struct sockaddr*)&saServer, len);

Reply via email to