-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

On Friday 27 December 2002 01:03, Stipe Tolj wrote:
> Hi Alex,
>
> Alexander Malysh schrieb:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Hi,
> >
> > here is small patch to get heartbeat work again ...
>
> thanks for the patch. We appritiate your commitment.

Ah sorry , I thought that it is self-describing ;)

Index: gw/heartbeat.c
===================================================================
RCS file: /home/cvs/gateway/gw/heartbeat.c,v
retrieving revision 1.3
diff -a -u -r1.3 heartbeat.c
- --- gw/heartbeat.c    29 May 2002 12:27:21 -0000      1.3
+++ gw/heartbeat.c      26 Dec 2002 22:02:43 -0000
@@ -56,11 +56,12 @@
          * This is not bad unless we send them way too fast.  Make sure
          * our frequency is not more than twice the configured one.
          */
- -        if (difftime(last_hb, time(NULL)) < info->freq / 2)

Here is wrong difftime calculation and heartbeat messages will never be sent 
to bearerbox.

+        if (difftime(time(NULL), last_hb) < info->freq / 2)
             continue;

         msg = msg_create(heartbeat);
- -        msg->heartbeat.load = info->load_func();

This is just sanity check for the case , that you have no load function and 
want tell bearerbox , that you alive ...

+        if (NULL != info->load_func)
+            msg->heartbeat.load = info->load_func();
         info->send_func(msg);
         last_hb = time(NULL);
     }
@@ -70,6 +71,10 @@
                      hb_load_func_t *load_func)
 {
     struct hb_info *info;

Sanity check for case that someone want use heartbeat and doesn't define send 
function.

+
+    /* can't start with send_funct NULL */
+    if (send_func == NULL)
+        return -1;

     info = gw_malloc(sizeof(*info));
     info->send_func = send_func;


[snip]

- -- 
Mit besten Gr��en aus K�ln

Dipl.-Ing.
Alexander Malysh
___________________________________

Centrium GmbH
Ehrenstrasse 2
50672 K�ln

Fon: +49 (0221) 277 49 150
Fax: +49 (0221) 277 49 109

email: [EMAIL PROTECTED]
web: http://www.centrium.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+DFGznX3e5W+uJ0ERAqBSAKCi12LyQvyndPgFAlGupOxST2ymZACfUexp
QDxkPkUP+Za7T20wr2S2YeI=
=WUTL
-----END PGP SIGNATURE-----

Reply via email to