This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Possible problem in timeout.c
- From: "Niels Beier (NB)" <NB at tt dot dk>
- To: "'ecos-discuss at sources dot redhat dot com'" <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 3 Apr 2003 15:32:49 +0200
- Subject: [ECOS] Possible problem in timeout.c
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