From bb97bdcdc783d0a14c0d3b3d1d2d63447f501d97 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 6 May 2009 17:41:48 +0000 Subject: [PATCH] Fixing [LIBOMV-485] by replacing the GetHashCode() check at login with a randomly generated LoginID value git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2690 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse/Login.cs | 19 +++++++++++-------- OpenMetaverse/UDPBase.cs | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/OpenMetaverse/Login.cs b/OpenMetaverse/Login.cs index 20809c74..a498e51b 100644 --- a/OpenMetaverse/Login.cs +++ b/OpenMetaverse/Login.cs @@ -118,6 +118,10 @@ namespace OpenMetaverse public string ReadCritical; /// An array of string sent to the login server to enable various options public string[] Options; + + /// A randomly generated ID to distinguish between login attempts. This value is only used + /// internally in the library and is never sent over the wire + internal UUID LoginID; } public struct BuddyListEntry @@ -1250,6 +1254,9 @@ namespace OpenMetaverse private void BeginLogin() { LoginParams loginParams = CurrentContext.Value; + // Generate a random ID to identify this login attempt + loginParams.LoginID = UUID.Random(); + CurrentContext = loginParams; #region Sanity Check loginParams @@ -1454,15 +1461,11 @@ namespace OpenMetaverse try { reply.Parse(response.Value as Hashtable); - if (context.GetHashCode() != CurrentContext.Value.GetHashCode()) + if (context.LoginID != CurrentContext.Value.LoginID) { - Logger.Log("Login Response does not match login request", Helpers.LogLevel.Warning); - // TODO: Although the hash codes to not match the login appears to work correctly if - // we don't exit the process here. Need to look into why the hashcodes do not match with Mono. - // See LIBOMV-485 for additional information - // - // Temporarily disabling this to allow mono based clients to login with XML-RPC - //return; + Logger.Log("Login response does not match login request. Only one login can be attempted at a time", + Helpers.LogLevel.Error); + return; } } catch (Exception e) diff --git a/OpenMetaverse/UDPBase.cs b/OpenMetaverse/UDPBase.cs index 26022f26..20c83f74 100644 --- a/OpenMetaverse/UDPBase.cs +++ b/OpenMetaverse/UDPBase.cs @@ -200,7 +200,7 @@ namespace OpenMetaverse SocketFlags.None, //ref wrappedBuffer.Instance.RemoteEndPoint, ref buf.RemoteEndPoint, - new AsyncCallback(AsyncEndReceive), + AsyncEndReceive, //wrappedBuffer); buf); }