bug-gnunet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-GNUnet] Problem in server/tcpserver.c


From: Peter F Bradshaw
Subject: [bug-GNUnet] Problem in server/tcpserver.c
Date: Fri, 26 Apr 2002 14:55:31 +0800 (WST)

Hi;

I'm running the CVS source of this date. There is an endless loop
in processData(). This seems to occur as the result of some searchs
(i.e. gnunet-search).

Lines from 105 read:

   while (pos < sizeof(GPROXY_Message)) {
    n = read(sockDescriptor,
      &((char*)&buff)[pos],
      sizeof(GPROXY_Message)-pos);
    if (n < 0)
      break;
    pos += n;
    }

In some instances the read() is returning 0 which sets up an endless
loop. In the normal blocking case a return of 0 from read() indicates
EOF. Therefore, I think the code should be:

    while (pos < sizeof(GPROXY_Message)) {
      n = read(sockDescriptor,
               &((char*)&buff)[pos],
               sizeof(GPROXY_Message)-pos);
      if (n < 0)
              break;
      else if (n == 0)
        return;
      pos += n;
    }

Cheers

-- 
Peter F Bradshaw, address@hidden, ICQ 75431157 (exadios).
http://www.exadios.com
PGP public key at http://www.exadios.com/public_key.html
"Needs more salt" - Archimedes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]