From: Fredrik Tolf Date: Mon, 25 Feb 2008 04:44:45 +0000 (+0100) Subject: Merge branch 'master' of git.dolda2000.com:/srv/git/r/doldaconnect X-Git-Tag: 1.2~18 X-Git-Url: http://dolda2000.com/gitweb/?a=commitdiff_plain;h=24b67b52955f9fe26daad3abf08eb5305a488951;hp=ac3c36760b8f34c441e5dc143c977cee1298b139;p=doldaconnect.git Merge branch 'master' of git.dolda2000.com:/srv/git/r/doldaconnect --- diff --git a/clients/gnome-trans-applet/dolcon-trans-applet.c b/clients/gnome-trans-applet/dolcon-trans-applet.c index 5520776..e909d0c 100644 --- a/clients/gnome-trans-applet/dolcon-trans-applet.c +++ b/clients/gnome-trans-applet/dolcon-trans-applet.c @@ -80,7 +80,7 @@ static gboolean updatetip(struct appletdata *data) return(TRUE); } now = time(NULL); - if(data->curdisplay->cmptime == 0) + if((data->curdisplay->cmptime == 0) || (now == data->curdisplay->cmptime)) { strcpy(buf, _("Calculating remaining time...")); } else { diff --git a/clients/gtk2/dolcon.c b/clients/gtk2/dolcon.c index 60374f3..64eaf3e 100644 --- a/clients/gtk2/dolcon.c +++ b/clients/gtk2/dolcon.c @@ -829,7 +829,7 @@ void logincallback(int err, wchar_t *reason, void *data) switch(err) { case DC_LOGIN_ERR_SUCCESS: - dc_queuecmd(NULL, NULL, L"notify", L"all", L"on", NULL); + dc_queuecmd(NULL, NULL, L"notify", L"all", L"on", L"fn:peer", L"off", NULL); dc_getfnlistasync(getfnlistcallback, NULL); dc_gettrlistasync(gettrlistcallback, NULL); updatesbar("Authenticated"); diff --git a/daemon/fnet-dc.c b/daemon/fnet-dc.c index dc26782..f41f9bf 100644 --- a/daemon/fnet-dc.c +++ b/daemon/fnet-dc.c @@ -3013,8 +3013,6 @@ static void hubread(struct socket *sk, struct fnetnode *fn) } if(hub->queue.size > 1000) sk->ignread = 1; - else - sk->ignread = 0; } static void huberr(struct socket *sk, int err, struct fnetnode *fn) @@ -3245,8 +3243,6 @@ static void peerread(struct socket *sk, struct dcpeer *peer) if((newbuf = sockgetinbuf(sk, &datalen)) == NULL) return; - if(peer->inbufdata > 500000) /* Discard possibly malicious data */ - peer->inbufdata = 0; sizebuf2(peer->inbuf, peer->inbufdata + datalen, 1); memcpy(peer->inbuf + peer->inbufdata, newbuf, datalen); free(newbuf); @@ -3271,15 +3267,15 @@ static void peerread(struct socket *sk, struct dcpeer *peer) peer->state = PEER_STOP; break; } else { - if(peer->queue.size > 1000) + if(peer->queue.size > 50) sk->ignread = 1; - else - sk->ignread = 0; } } } else if(peer->state == PEER_TTHL) { handletthl(peer); } + if(peer->inbufdata > 500000) + sk->ignread = 1; } static void peererror(struct socket *sk, int err, struct dcpeer *peer) @@ -3755,9 +3751,10 @@ static int run(void) struct dchub *hub; struct dcpeer *peer, *nextpeer; struct qcommand *qcmd; - int ret; + int ret, quota; ret = 0; + quota = 20; for(fn = fnetnodes; fn != NULL; fn = nextfn) { nextfn = fn->next; @@ -3766,7 +3763,7 @@ static int run(void) if(fn->data == NULL) continue; hub = (struct dchub *)fn->data; - if((qcmd = ulqcmd(&hub->queue)) != NULL) + while((quota > 0) && ((qcmd = ulqcmd(&hub->queue)) != NULL)) { if(*qcmd->string == '$') { @@ -3777,13 +3774,18 @@ static int run(void) } freeqcmd(qcmd); ret = 1; - break; + quota--; } + if(hub->queue.size < 1000) + hub->sk->ignread = 0; + if(quota < 1) + break; } + quota = 20; for(peer = peers; peer != NULL; peer = nextpeer) { nextpeer = peer->next; - if((qcmd = ulqcmd(&peer->queue)) != NULL) + while((quota > 0) && ((qcmd = ulqcmd(&peer->queue)) != NULL)) { if(peer->timeout != NULL) canceltimer(peer->timeout); @@ -3792,8 +3794,12 @@ static int run(void) dispatchcommand(qcmd, peercmds, peer->sk, peer); freeqcmd(qcmd); ret = 1; - break; + quota--; } + if((peer->queue.size < 50) && (peer->inbufdata < 500000)) + peer->sk->ignread = 0; + if(quota < 1) + break; } return(ret); }