summaryrefslogtreecommitdiff
path: root/os/access.c
diff options
context:
space:
mode:
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>2010-12-30 19:19:43 +0200
committerDaniel Stone <daniel@fooishbar.org>2010-12-31 12:52:51 +0000
commit2d67ada3c4079a11c52024a9c3d4138becca5171 (patch)
tree5763fe3654e4165af07ddad710b549aa504c4bd5 /os/access.c
parent617b7d22115ccaaaa7ec69c99885054d33a3bc37 (diff)
os: always check if client is local when connection is accepted
LocalClient is used for all DRI2 requests that makes it frequently called function. Querying if connection is local or not takes 10-15us (on ARM) depending on malloc speed. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'os/access.c')
-rw-r--r--os/access.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/os/access.c b/os/access.c
index 494986e1e..eb1a21d42 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1028,20 +1028,19 @@ ResetHosts (char *display)
}
/* Is client on the local host */
-Bool LocalClient(ClientPtr client)
+Bool
+ComputeLocalClient(ClientPtr client)
{
int alen, family, notused;
Xtransaddr *from = NULL;
pointer addr;
register HOST *host;
+ OsCommPtr oc = (OsCommPtr) client->osPrivate;
- if (!client->osPrivate)
- return FALSE;
- if (!((OsCommPtr)client->osPrivate)->trans_conn)
+ if (!oc->trans_conn)
return FALSE;
- if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
- &notused, &alen, &from))
+ if (!_XSERVTransGetPeerAddr (oc->trans_conn, &notused, &alen, &from))
{
family = ConvertAddr ((struct sockaddr *) from,
&alen, (pointer *)&addr);
@@ -1067,6 +1066,13 @@ Bool LocalClient(ClientPtr client)
return FALSE;
}
+Bool LocalClient(ClientPtr client)
+{
+ if (!client->osPrivate)
+ return FALSE;
+ return ((OsCommPtr)client->osPrivate)->local_client;
+}
+
/*
* Return the uid and gid of a connected local client
*