Bugzilla – Attachment 211446 Details for
Bug 385150
avoid redundant hostname lookup in session ...
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
patch to work around the performance issue
gnome-session-speed.diff (text/x-diff), 1.64 KB, created by
Michael Meeks
on 2008-04-30 09:58:55 UTC
(
hide
)
Description:
patch to work around the performance issue
Filename:
MIME Type:
Creator:
Michael Meeks
Created:
2008-04-30 09:58:55 UTC
Size:
1.64 KB
patch
obsolete
>--- pristine-gnome-session-2.22.1.1/gnome-session/manager.c 2008-04-10 15:32:20.000000000 +0100 >+++ gnome-session-2.22.1.1/gnome-session/manager.c 2008-04-30 10:53:27.000000000 +0100 >@@ -825,7 +825,6 @@ > return retval; > } > >- > static Status > register_client (SmsConn connection, SmPointer data, char *previous_id) > { >@@ -882,33 +881,20 @@ > } > else > { >- char *id = SmsGenerateClientID (connection); >- >- if (id != NULL) >- { >- client->id = g_strdup (id); >- free (id); >- } >- else >+ /* If your network is mis-configured, it takes 15+ seconds for >+ SmsGenerateClientID to fail each time it is called - and since >+ the X method (libSM/src/sm_genid.c) does little of any value - >+ beyond creating a unique identifier - we do that ourselves >+ here instead rather more quickly. */ > { > static long int sequence = 0; >- static char* address = NULL; >- >- if (! address) >- { >- g_warning ("Host name lookup failure on localhost."); >- >- address = g_new (char, 10); >- srand (time (NULL) + (getpid () <<16)); >- g_snprintf (address, 10, "0%.8x", rand()); >- }; > > /* The typecast there is for 64-bit machines */ >- client->id = g_malloc (43); >- g_snprintf (client->id, 43, "1%s%.13ld%.10ld%.4ld", address, >- (long) time(NULL), (long) getpid (), sequence); >+ client->id = g_strdup_printf ("10%.8x%.13ld%.10ld%.4ld", >+ g_str_hash (g_get_host_name()), >+ (long) time(NULL), (long) getpid (), >+ sequence); > sequence++; >- > sequence %= 10000; > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 385150
: 211446