Hi,

On 1/11/06, Dale Blount <[EMAIL PROTECTED]> wrote:
> It (finally?) happened again, here's the debugging data I've collected
> so far.  I've left it running incase you need me to attach gdb to it
> (please provide gdb commands you'd like me to run).
>

Having a look on the debug data you provided ...

I checked freshclam/manager.c from cvs and I think it hangs around
line 812 in function
int get_database(const char *dbfile, int socketfd, const char *file,
const char *hostname, const char *proxy, const char *user, const char
*pass)

code is

    /* receive body and write it to disk */

    while((bread = read(socketfd, buffer, FILEBUFF))) {
        write(fd, buffer, bread);
        if(!mprintf_quiet) {
            mprintf("Downloading %s [%c]\r", dbfile, rotation[rot]);
            fflush(stdout);
            rot++;
            rot %= 4;
        }
    }

the problem I see is, as long as the server does not close the
connection, _this_ won't quit,  as there is no way to close the
connection clientside.

2 suggestions
a) poll() || select() to specify a timeout
this has to be added *everywhere* you recv() something.

b) setsockopt() & SO_RCVTIMEO
set a receive timeout, this will make sthe socket handle not receiving
data for a given period of time as an error.

this is pretty easy, and has to be done only once, I'd say after
connecting the socket

struct timeval Timeout = { 2, 500 };
if(setsockopt(hostfd, SOL_SOCKET, SO_RCVTIMEO, &Timeout, sizeof(Timeout)) < 0)
{
  printf("could not set timeout for socket %i\n",hostfd);
}else
{
  printf("set timeout on socket %i\n",hostfd);
}



If you got additional information, (gdb) we will be able to back this
up, or break it.

MfG
Markus Koetter
_______________________________________________
http://lurker.clamav.net/list/clamav-users.html

Reply via email to