OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ch_buffer.c versions 1.24 and 1.25
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ch_buffer.c 1.24 -> 1.25

--- l2_ch_buffer.c       2001/10/12 14:46:17     1.24
+++ l2_ch_buffer.c       2001/10/22 16:32:29     1.25
@@ -53,16 +53,21 @@
 static void catchsignal(int sig, ...)
 {
     va_list ap;
-    static  l2_channel_t *ch = NULL;
+    static  l2_channel_t   *ch  = NULL;
+    static  l2_ch_buffer_t *cfg = NULL;
 
     if (sig == 0) {
         va_start(ap, sig);
-        ch = va_arg(ap, l2_channel_t *);
+        ch  = va_arg(ap, l2_channel_t   *); /* init the handler just like */
+        cfg = va_arg(ap, l2_ch_buffer_t *); /* Thomas Lotterer does       */
         va_end(ap);
     }
     else if (sig == SIGALRM) {
         TRACE("SIGALRM caught");
         l2_channel_flush(ch);
+#ifndef HAVE_SETITIMER
+        reset_alarm(cfg); /* alarm(3) doesn't auto-reset like setitime(2) */
+#endif
     }
 }
 
@@ -130,6 +135,7 @@
     valnew.it_value.tv_usec = 0;
     return setitimer(L2_BUFFER_TIMER, &valnew, &cfg->valprev);
 #else
+    alarm(cfg->bufinterval);
     return 0;
 #endif
 }
@@ -152,6 +158,7 @@
     valnew.it_value.tv_usec = 0;
     return setitimer(L2_BUFFER_TIMER, &valnew, 0);
 #else
+    alarm(cfg->bufinterval);
     return 0;
 #endif
 }
@@ -172,7 +179,7 @@
         sigemptyset(&locact.sa_mask);
         locact.sa_flags = 0;
 
-        catchsignal(0, ch);
+        catchsignal(0, ch, (l2_ch_buffer_t *)ctx->vp);
         /* save old signal context before replacing with our own */
         if (sigaction(SIGALRM, &locact, &cfg->sigalrm) < 0)
             return L2_ERR_SYS;
@@ -243,6 +250,7 @@
     l2_result_t rv;
 
     /* write the buffer contents downstream */
+TRACE("l2_ch_buffer hook_flush called\n");
     if (cfg->bufpos > 0) {
         if ((rv = l2_channel_write(downstream, cfg->level, cfg->buf, cfg->bufpos)) != L2_OK)
             return rv;

CVSTrac 2.0.1