[PATCH 4/5] resource: Remove expectID hack

Adam Jackson ajax at redhat.com
Fri Jan 7 11:27:28 PST 2011


This is clearly meant to short-circuit the (modestly) expensive resource
lookup in LegalNewID.  The problem is that long-lived clients will
eventually run completely through their XID space and start asking
XC-MISC for IDs to reuse.  Once that happens, the comparison against
expectID will always be true, and we'll no longer catch XID collisions
at all.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 dix/resource.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/dix/resource.c b/dix/resource.c
index a5737f3..4545a70 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -173,7 +173,6 @@ typedef struct _ClientResource {
     int		buckets;
     XID		fakeID;
     XID		endFakeID;
-    XID		expectID;
 } ClientResourceRec;
 
 RESTYPE lastResourceType;
@@ -332,7 +331,6 @@ InitClientResources(ClientPtr client)
     clientTable[i].fakeID = client->clientAsMask |
 			    (client->index ? SERVER_BIT : SERVER_MINID);
     clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1;
-    clientTable[i].expectID = client->clientAsMask;
     for (j=0; j<INITBUCKETS; j++) 
     {
         clientTable[i].resources[j] = NULL;
@@ -520,8 +518,6 @@ AddResource(XID id, RESTYPE type, pointer value)
     res->value = value;
     *head = res;
     rrec->elements++;
-    if (!(id & SERVER_BIT) && (id >= rrec->expectID))
-	rrec->expectID = id + 1;
     CallResourceStateCallback(ResourceStateAdding, res);
     return TRUE;
 }
@@ -903,9 +899,6 @@ LegalNewID(XID id, ClientPtr client)
 #endif /* PANORAMIX */
 	if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
 	{
-	    if (clientTable[client->index].expectID <= id)
-		return TRUE;
-
 	    rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
 					  DixGetAttrAccess);
 	    return rc == BadValue;
-- 
1.7.3.1



More information about the xorg-devel mailing list