[omniORB] bug in tcpConnection.cc

Clemens Fischer fischer.c@stn-atlas.de
Tue Apr 15 08:06:02 2003


Hi all,

when a client call timeout value has been set,
tcpConnection::Recv()
in src/lib/omniORB/orbcore/tcp/tcpConnection.cc
calculates a timeout value for a select() call and
puts this value into a struct timeval t.

If USE_FAKE_INTERRUPTABLE_RECV is defined,
then in line 226 t.tv_sec is compared to
orbParameters::scanGranularity and, if greater,
set to orbParameters::scanGranularity.

It may happen that orbParameters::scanGranularity
is zero (e.g. if lcdMode is set), and thus t.tv_sec
becomes zero, too. When now t.tv_usec is also zero,
select() isn't called at all (see line 240).

The observed behaviour is that setClientCallTimeout()
has no effect for a timeout value that is a integer
multiple of a second (where t.tv_usec == 0).

The comparison in line 226 should be changed from:
  if (t.tv_sec > orbParameters::scanGranularity)
to something like:
  if (orbParameters::scanGranularity > 0 &&
      t.tv_sec > orbParameters::scanGranularity)

Regards

Clemens