struct uidata *next, *prev;
struct socket *sk;
struct qcommand *queue, *queuelast;
+ size_t queuesize;
struct authhandle *auth;
int close;
union
}
if(fn->peers == NULL)
{
- sq(sk, 0, L"201", L"No peers avaiable", NULL);
+ sq(sk, 0, L"201", L"No peers available", NULL);
} else {
for(peer = btreeiter(fn->peers); peer != NULL; peer = npeer)
{
qcmd = data->queue;
if(qcmd != NULL)
{
+ data->queuesize--;
data->queue = qcmd->next;
if(qcmd == data->queuelast)
data->queuelast = qcmd->next;
data->queuelast = new;
if(data->queue == NULL)
data->queue = new;
+ data->queuesize++;
}
static struct uidata *newuidata(struct socket *sk)
break;
}
}
+ if(data->cbdata > 16384)
+ {
+ /* Kill clients that send us unreasonably long lines */
+ data->close = 1;
+ }
}
static void uierror(struct socket *sk, int err, struct uidata *data)
freequeuecmd(qcmd);
return(1);
}
+ if(data->queuesize > 10)
+ {
+ /* Clients should not be queue up commands at all, since
+ * they should not send a new command before receiving a
+ * reply to the previous command. Therefore, we
+ * mercilessly massacre clients which are stacking up too
+ * many commands. */
+ data->close = 1;
+ }
}
return(0);
}