From eaadb889d59597ddcb7e3d2ad31a933a30609401 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 18 Dec 2021 10:44:43 +0000 Subject: [PATCH] fix NeighbourHandler --- OpenSim/Server/Handlers/Base/Utils.cs | 10 +++++----- .../Handlers/Neighbour/NeighbourHandlers.cs | 2 +- .../Neighbour/NeighbourServiceInConnector.cs | 2 +- .../Neighbour/NeighbourServicesConnector.cs | 19 +++++++++---------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/OpenSim/Server/Handlers/Base/Utils.cs b/OpenSim/Server/Handlers/Base/Utils.cs index c61fb8e108..3b1fb01612 100644 --- a/OpenSim/Server/Handlers/Base/Utils.cs +++ b/OpenSim/Server/Handlers/Base/Utils.cs @@ -40,7 +40,7 @@ namespace OpenSim.Server.Handlers.Base /// /// Extract the param from an uri. /// - /// Something like this: /uuid/ or /uuid/handle/release + /// Something like this: /xxxx/uuid/ or /uuid/handle/release /// uuid on uuid field /// optional action public static bool GetParams(string path, out UUID uuid, out ulong regionHandle, out string action) @@ -57,13 +57,13 @@ namespace OpenSim.Server.Handlers.Base } else { - if (!UUID.TryParse(parts[0], out uuid)) + if (!UUID.TryParse(parts[1], out uuid)) return false; - if (parts.Length >= 2) - UInt64.TryParse(parts[1], out regionHandle); if (parts.Length >= 3) - action = parts[2]; + UInt64.TryParse(parts[2], out regionHandle); + if (parts.Length >= 4) + action = parts[3]; return true; } diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs index c36f85bf4f..560216a35a 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourHandlers.cs @@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.Neighbour return; } - if (RestHandlerUtils.GetParams(httpRequest.UriPath, out UUID regionID, out ulong regionHandle, out string action) + if (!RestHandlerUtils.GetParams(httpRequest.UriPath, out UUID regionID, out ulong regionHandle, out string action) || regionID == UUID.Zero) { m_log.InfoFormat("[RegionPostHandler]: Invalid parameters for neighbour message {0}", httpRequest.UriPath); diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs index 33b9727afa..4aef856bf6 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs @@ -60,7 +60,7 @@ namespace OpenSim.Server.Handlers.Neighbour //if (authentication) // m_AuthenticationService = scene.RequestModuleInterface(); - server.AddSimpleStreamHandler(new NeighbourSimpleHandler(m_NeighbourService, m_AuthenticationService)); + server.AddSimpleStreamHandler(new NeighbourSimpleHandler(m_NeighbourService, m_AuthenticationService), true); } } } diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 3dd0703fae..86a28479d6 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -96,9 +96,8 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.Warn(string.Format( - "[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2} ", - thisRegion.RegionName, region.RegionName, e.Message), e); + m_log.WarnFormat("[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception: {2} ", + thisRegion.RegionName, region.RegionName, e.Message); return false; } @@ -112,9 +111,9 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.Warn(string.Format( - "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3} ", - uri, thisRegion.RegionName, region.RegionName, e.Message), e); + m_log.WarnFormat( + "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception: {3} ", + uri, thisRegion.RegionName, region.RegionName, e.Message); return false; } @@ -150,7 +149,7 @@ namespace OpenSim.Services.Connectors using (StreamReader sr = new StreamReader(webResponse.GetResponseStream())) { sr.ReadToEnd(); // just try to read - //reply = sr.ReadToEnd().Trim(); + //string reply = sr.ReadToEnd(); //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); } } @@ -158,9 +157,9 @@ namespace OpenSim.Services.Connectors } catch (Exception e) { - m_log.Warn(string.Format( - "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2} ", - region.RegionName, thisRegion.RegionName, e.Message), e); + m_log.WarnFormat( + "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception: {2} ", + region.RegionName, thisRegion.RegionName, e.Message); } return false; }