public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Niels Beier (NB)" <NB@tt.dk>
To: "'ecos-discuss@sources.redhat.com'" <ecos-discuss@sources.redhat.com>
Subject: [ECOS] Possible problem in timeout.c
Date: Thu, 03 Apr 2003 13:32:00 -0000	[thread overview]
Message-ID: <E70B4FA554FB6C44BC7FAC9A9CE0CBC43611A6@ntex.tt.dk> (raw)

I think I have found a bug in /net/bsd_tcpip/current/src/ecos/timeout.c -
Trunk 2.0 version - last CVS update 25 marts-2003
(I have discovered the problem as tcp_slowtimo in bsd_tcpip is never called)

It seems only to be possible to create a single callout.

In the timeout() function the following code may have a problem:

    stamp = 0;  // Assume no slots available
    for (e = _timeouts;  e;  e = e->next) {
        if ((e->flags & CALLOUT_PENDING) == 0) {
            // Free entry
            callout_init(e);
            e->flags = CALLOUT_LOCAL;
            callout_reset(e, delta, fun, arg);
            stamp = (cyg_uint32)e;
            break;
        }
    }
When the first callot is inserted, the callout_reset() functions sets
the "next" field in the first element of the _timeouts array to zero (as 
timeous is initially equal to zero) and
the second call to timeout() will fail.


The "for loop" should be changed to something like this:
    for (i = 0; i < NTIMEOUTS; i++) {
        e = &_timeouts[i];
        if ((e->flags & CALLOUT_PENDING) == 0) {
            // Free entry
            callout_init(e);
            e->flags = CALLOUT_LOCAL;
            callout_reset(e, delta, fun, arg);
            stamp = (cyg_uint32)e;
            break;
        }
    }    

Is there something, that I have misses?

Best regards
Niels Beier
Thrane&Thrane A/S

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

             reply	other threads:[~2003-04-03 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-03 13:32 Niels Beier (NB) [this message]
2003-04-08  0:47 ` Jonathan Larmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E70B4FA554FB6C44BC7FAC9A9CE0CBC43611A6@ntex.tt.dk \
    --to=nb@tt.dk \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).