size_t inbufdata, inbufsize;
size_t curread, totalsize;
int freeing;
+ struct timer *timeout;
struct qcommand *queue;
struct transfer *transfer;
int state;
free(chat);
}
+static void peertimeout(int cancelled, struct dcpeer *peer)
+{
+ peer->timeout = NULL;
+ if(cancelled)
+ return;
+ freedcpeer(peer);
+}
+
static void sendadc(struct socket *sk, char *arg)
{
char *buf;
static void startdl(struct dcpeer *peer)
{
+ if(peer->timeout != NULL)
+ canceltimer(peer->timeout);
peer->state = PEER_TRNS;
transferstartdl(peer->transfer, peer->sk);
peer->sk->readcb = (void (*)(struct socket *, void *))transread;
static void startul(struct dcpeer *peer)
{
+ if(peer->timeout != NULL)
+ canceltimer(peer->timeout);
peer->state = PEER_TRNS;
transferstartul(peer->transfer, peer->sk);
peer->sk->writecb = (void (*)(struct socket *, void *))transwrite;
}
if(peer->curread >= peer->totalsize)
{
+ if(peer->timeout == NULL)
+ peer->timeout = timercallback(ntime() + 180, (void (*)(int, void *))peertimeout, peer);
peer->state = PEER_CMD;
synctigertree(&peer->tth);
restigertree(&peer->tth, buf);
freedcpeer(peer);
goto out;
}
+ if(peer->timeout != NULL)
+ canceltimer(peer->timeout);
peer->state = PEER_TTHL;
peer->totalsize = numbytes;
peer->curread = 0;
{
freedcpeer(peer);
} else {
+ if(peer->timeout == NULL)
+ peer->timeout = timercallback(ntime() + 180, (void (*)(int, void *))peertimeout, peer);
peer->state = PEER_CMD;
endcompress(peer);
transfersetstate(transfer, TRNS_HS);
resettransfer(peer->transfer);
transferdetach(peer->transfer);
}
+ if(peer->timeout != NULL)
+ canceltimer(peer->timeout);
if(peer->sk->data == peer)
peer->sk->data = NULL;
peer->sk->readcb = NULL;
sk->data = peer;
socksettos(sk, confgetint("fnet", "fnptos"));
putsock(sk);
+ peer->timeout = timercallback(ntime() + 180, (void (*)(int, void *))peertimeout, peer);
sendmynick(peer);
sendpeerlock(peer);
}
newsk->errcb = (void (*)(struct socket *, int, void *))peererror;
newsk->data = peer;
socksettos(newsk, confgetint("fnet", "fnptos"));
+ peer->timeout = timercallback(ntime() + 180, (void (*)(int, void *))peertimeout, peer);
}
static void updatehmlist(void)
nextpeer = peer->next;
if((qcmd = ulqcmd(&peer->queue)) != NULL)
{
+ if(peer->timeout != NULL)
+ canceltimer(peer->timeout);
+ peer->timeout = timercallback(ntime() + 180, (void (*)(int, void *))peertimeout, peer);
if(*qcmd->string == '$')
dispatchcommand(qcmd, peercmds, peer->sk, peer);
freeqcmd(qcmd);