mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-30 21:53:25 +00:00
Bigreqs are built-in and mandatory.
This commit is contained in:
parent
d6228cb22a
commit
f65c50c4e9
8 changed files with 3 additions and 58 deletions
20
os/io.c
20
os/io.c
|
|
@ -106,13 +106,11 @@ static OsCommPtr AvailableInput = (OsCommPtr)NULL;
|
|||
#define get_req_len(req,cli) ((cli)->swapped ? \
|
||||
lswaps((req)->length) : (req)->length)
|
||||
|
||||
#ifdef BIGREQS
|
||||
#include <X11/extensions/bigreqstr.h>
|
||||
|
||||
#define get_big_req_len(req,cli) ((cli)->swapped ? \
|
||||
lswapl(((xBigReq *)(req))->length) : \
|
||||
((xBigReq *)(req))->length)
|
||||
#endif
|
||||
|
||||
#define MAX_TIMES_PER 10
|
||||
|
||||
|
|
@ -192,9 +190,7 @@ ReadRequestFromClient(ClientPtr client)
|
|||
int result;
|
||||
register xReq *request;
|
||||
Bool need_header;
|
||||
#ifdef BIGREQS
|
||||
Bool move_header;
|
||||
#endif
|
||||
|
||||
/* If an input buffer was empty, either free it if it is too big
|
||||
* or link it into our list of free input buffers. This means that
|
||||
|
|
@ -243,9 +239,7 @@ ReadRequestFromClient(ClientPtr client)
|
|||
oci->bufptr += oci->lenLastReq;
|
||||
|
||||
need_header = FALSE;
|
||||
#ifdef BIGREQS
|
||||
move_header = FALSE;
|
||||
#endif
|
||||
gotnow = oci->bufcnt + oci->buffer - oci->bufptr;
|
||||
if (gotnow < sizeof(xReq))
|
||||
{
|
||||
|
|
@ -262,7 +256,6 @@ ReadRequestFromClient(ClientPtr client)
|
|||
*/
|
||||
request = (xReq *)oci->bufptr;
|
||||
needed = get_req_len(request, client);
|
||||
#ifdef BIGREQS
|
||||
if (!needed && client->big_requests)
|
||||
{
|
||||
/* It's a Big Request. */
|
||||
|
|
@ -276,7 +269,6 @@ ReadRequestFromClient(ClientPtr client)
|
|||
else
|
||||
needed = get_big_req_len(request, client);
|
||||
}
|
||||
#endif
|
||||
client->req_len = needed;
|
||||
needed <<= 2; /* needed is in bytes now */
|
||||
}
|
||||
|
|
@ -289,14 +281,12 @@ ReadRequestFromClient(ClientPtr client)
|
|||
*/
|
||||
|
||||
oci->lenLastReq = 0;
|
||||
#ifdef BIGREQS
|
||||
if (needed > maxBigRequestSize << 2)
|
||||
{
|
||||
/* request is too big for us to handle */
|
||||
YieldControlDeath();
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
if ((gotnow == 0) ||
|
||||
((oci->bufptr - oci->buffer + needed) > oci->size))
|
||||
{
|
||||
|
|
@ -373,7 +363,6 @@ ReadRequestFromClient(ClientPtr client)
|
|||
/* We wanted an xReq, now we've gotten it. */
|
||||
request = (xReq *)oci->bufptr;
|
||||
needed = get_req_len(request, client);
|
||||
#ifdef BIGREQS
|
||||
if (!needed && client->big_requests)
|
||||
{
|
||||
move_header = TRUE;
|
||||
|
|
@ -382,7 +371,6 @@ ReadRequestFromClient(ClientPtr client)
|
|||
else
|
||||
needed = get_big_req_len(request, client);
|
||||
}
|
||||
#endif
|
||||
client->req_len = needed;
|
||||
needed <<= 2;
|
||||
}
|
||||
|
|
@ -395,11 +383,9 @@ ReadRequestFromClient(ClientPtr client)
|
|||
}
|
||||
if (needed == 0)
|
||||
{
|
||||
#ifdef BIGREQS
|
||||
if (client->big_requests)
|
||||
needed = sizeof(xBigReq);
|
||||
else
|
||||
#endif
|
||||
needed = sizeof(xReq);
|
||||
}
|
||||
oci->lenLastReq = needed;
|
||||
|
|
@ -417,12 +403,10 @@ ReadRequestFromClient(ClientPtr client)
|
|||
{
|
||||
request = (xReq *)(oci->bufptr + needed);
|
||||
if (gotnow >= (result = (get_req_len(request, client) << 2))
|
||||
#ifdef BIGREQS
|
||||
&& (result ||
|
||||
(client->big_requests &&
|
||||
(gotnow >= sizeof(xBigReq) &&
|
||||
gotnow >= (get_big_req_len(request, client) << 2))))
|
||||
#endif
|
||||
)
|
||||
FD_SET(fd, &ClientsWithInput);
|
||||
else
|
||||
|
|
@ -451,7 +435,6 @@ ReadRequestFromClient(ClientPtr client)
|
|||
#endif
|
||||
if (++timesThisConnection >= MAX_TIMES_PER)
|
||||
YieldControl();
|
||||
#ifdef BIGREQS
|
||||
if (move_header)
|
||||
{
|
||||
request = (xReq *)oci->bufptr;
|
||||
|
|
@ -460,7 +443,6 @@ ReadRequestFromClient(ClientPtr client)
|
|||
oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
|
||||
client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2;
|
||||
}
|
||||
#endif
|
||||
client->requestBuffer = (pointer)oci->bufptr;
|
||||
#ifdef DEBUG_COMMUNICATION
|
||||
{
|
||||
|
|
@ -572,7 +554,6 @@ ResetCurrentRequest(ClientPtr client)
|
|||
{
|
||||
request = (xReq *)oci->bufptr;
|
||||
needed = get_req_len(request, client);
|
||||
#ifdef BIGREQS
|
||||
if (!needed && client->big_requests)
|
||||
{
|
||||
oci->bufptr -= sizeof(xBigReq) - sizeof(xReq);
|
||||
|
|
@ -584,7 +565,6 @@ ResetCurrentRequest(ClientPtr client)
|
|||
swapl(&((xBigReq *)oci->bufptr)->length, n);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (gotnow >= (needed << 2))
|
||||
{
|
||||
if (FD_ISSET(fd, &AllClients))
|
||||
|
|
|
|||
Loading…
Reference in a new issue