diff options
author | Jeff Ames | 2009-06-14 21:37:50 +0000 |
---|---|---|
committer | Jeff Ames | 2009-06-14 21:37:50 +0000 |
commit | 8d0eb3307fe665aed35209184ff4736e7c6170c4 (patch) | |
tree | bd9e4f24df736715ad9fe48f69f3c2421c68195e /OpenSim/Services/Connectors | |
parent | Renamed Region/CoreModules/ServiceConnectors to Region/CoreModules/ServiceCon... (diff) | |
download | opensim-SC_OLD-8d0eb3307fe665aed35209184ff4736e7c6170c4.zip opensim-SC_OLD-8d0eb3307fe665aed35209184ff4736e7c6170c4.tar.gz opensim-SC_OLD-8d0eb3307fe665aed35209184ff4736e7c6170c4.tar.bz2 opensim-SC_OLD-8d0eb3307fe665aed35209184ff4736e7c6170c4.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | 340 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs | 332 |
2 files changed, 336 insertions, 336 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index fbb2707..e95b83d 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | |||
@@ -1,170 +1,170 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Servers.HttpServer; | 35 | using OpenSim.Framework.Servers.HttpServer; |
36 | using OpenSim.Services.Interfaces; | 36 | using OpenSim.Services.Interfaces; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | namespace OpenSim.Services.Connectors | 39 | namespace OpenSim.Services.Connectors |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// This connector is temporary. It's used by the user server, before that server is refactored. | 42 | /// This connector is temporary. It's used by the user server, before that server is refactored. |
43 | /// </summary> | 43 | /// </summary> |
44 | public class QuickAndDirtyInventoryServiceConnector : IInventoryService | 44 | public class QuickAndDirtyInventoryServiceConnector : IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private string m_ServerURI = String.Empty; | 50 | private string m_ServerURI = String.Empty; |
51 | 51 | ||
52 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); | 52 | private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory = new Dictionary<UUID, InventoryReceiptCallback>(); |
53 | 53 | ||
54 | public QuickAndDirtyInventoryServiceConnector() | 54 | public QuickAndDirtyInventoryServiceConnector() |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | public QuickAndDirtyInventoryServiceConnector(string serverURI) | 58 | public QuickAndDirtyInventoryServiceConnector(string serverURI) |
59 | { | 59 | { |
60 | m_ServerURI = serverURI.TrimEnd('/'); | 60 | m_ServerURI = serverURI.TrimEnd('/'); |
61 | } | 61 | } |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | 64 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> |
65 | /// </summary> | 65 | /// </summary> |
66 | /// <param name="userId"></param> | 66 | /// <param name="userId"></param> |
67 | /// <returns></returns> | 67 | /// <returns></returns> |
68 | public bool CreateUserInventory(UUID userId) | 68 | public bool CreateUserInventory(UUID userId) |
69 | { | 69 | { |
70 | return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( | 70 | return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( |
71 | "POST", m_ServerURI + "CreateInventory/", userId.Guid); | 71 | "POST", m_ServerURI + "CreateInventory/", userId.Guid); |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | 75 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <param name="userId"></param> | 77 | /// <param name="userId"></param> |
78 | /// <returns></returns> | 78 | /// <returns></returns> |
79 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 79 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
80 | { | 80 | { |
81 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( | 81 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( |
82 | "POST", m_ServerURI + "RootFolders/", userId.Guid); | 82 | "POST", m_ServerURI + "RootFolders/", userId.Guid); |
83 | } | 83 | } |
84 | 84 | ||
85 | /// <summary> | 85 | /// <summary> |
86 | /// Returns a list of all the active gestures in a user's inventory. | 86 | /// Returns a list of all the active gestures in a user's inventory. |
87 | /// </summary> | 87 | /// </summary> |
88 | /// <param name="userId"> | 88 | /// <param name="userId"> |
89 | /// The <see cref="UUID"/> of the user | 89 | /// The <see cref="UUID"/> of the user |
90 | /// </param> | 90 | /// </param> |
91 | /// <returns> | 91 | /// <returns> |
92 | /// A flat list of the gesture items. | 92 | /// A flat list of the gesture items. |
93 | /// </returns> | 93 | /// </returns> |
94 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | 94 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
95 | { | 95 | { |
96 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>( | 96 | return SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryItemBase>>( |
97 | "POST", m_ServerURI + "ActiveGestures/", userId.Guid); | 97 | "POST", m_ServerURI + "ActiveGestures/", userId.Guid); |
98 | } | 98 | } |
99 | 99 | ||
100 | public InventoryCollection GetUserInventory(UUID userID) | 100 | public InventoryCollection GetUserInventory(UUID userID) |
101 | { | 101 | { |
102 | return null; | 102 | return null; |
103 | } | 103 | } |
104 | 104 | ||
105 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 105 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
106 | { | 106 | { |
107 | } | 107 | } |
108 | 108 | ||
109 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 109 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
110 | { | 110 | { |
111 | return null; | 111 | return null; |
112 | } | 112 | } |
113 | 113 | ||
114 | public bool AddFolder(InventoryFolderBase folder) | 114 | public bool AddFolder(InventoryFolderBase folder) |
115 | { | 115 | { |
116 | return false; | 116 | return false; |
117 | } | 117 | } |
118 | 118 | ||
119 | public bool UpdateFolder(InventoryFolderBase folder) | 119 | public bool UpdateFolder(InventoryFolderBase folder) |
120 | { | 120 | { |
121 | return false; | 121 | return false; |
122 | } | 122 | } |
123 | 123 | ||
124 | public bool MoveFolder(InventoryFolderBase folder) | 124 | public bool MoveFolder(InventoryFolderBase folder) |
125 | { | 125 | { |
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | 128 | ||
129 | public bool PurgeFolder(InventoryFolderBase folder) | 129 | public bool PurgeFolder(InventoryFolderBase folder) |
130 | { | 130 | { |
131 | return false; | 131 | return false; |
132 | } | 132 | } |
133 | 133 | ||
134 | public bool AddItem(InventoryItemBase item) | 134 | public bool AddItem(InventoryItemBase item) |
135 | { | 135 | { |
136 | return false; | 136 | return false; |
137 | } | 137 | } |
138 | 138 | ||
139 | public bool UpdateItem(InventoryItemBase item) | 139 | public bool UpdateItem(InventoryItemBase item) |
140 | { | 140 | { |
141 | return false; | 141 | return false; |
142 | } | 142 | } |
143 | 143 | ||
144 | public bool DeleteItem(InventoryItemBase item) | 144 | public bool DeleteItem(InventoryItemBase item) |
145 | { | 145 | { |
146 | return false; | 146 | return false; |
147 | } | 147 | } |
148 | 148 | ||
149 | public InventoryItemBase QueryItem(InventoryItemBase item) | 149 | public InventoryItemBase QueryItem(InventoryItemBase item) |
150 | { | 150 | { |
151 | return null; | 151 | return null; |
152 | } | 152 | } |
153 | 153 | ||
154 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | 154 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) |
155 | { | 155 | { |
156 | return null; | 156 | return null; |
157 | } | 157 | } |
158 | 158 | ||
159 | public bool HasInventoryForUser(UUID userID) | 159 | public bool HasInventoryForUser(UUID userID) |
160 | { | 160 | { |
161 | return false; | 161 | return false; |
162 | } | 162 | } |
163 | 163 | ||
164 | public InventoryFolderBase RequestRootFolder(UUID userID) | 164 | public InventoryFolderBase RequestRootFolder(UUID userID) |
165 | { | 165 | { |
166 | return null; | 166 | return null; |
167 | } | 167 | } |
168 | 168 | ||
169 | } | 169 | } |
170 | } | 170 | } |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 26f606d..7fff537 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs | |||
@@ -1,166 +1,166 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Net; | 33 | using System.Net; |
34 | using System.Reflection; | 34 | using System.Reflection; |
35 | using System.Text; | 35 | using System.Text; |
36 | using Nini.Config; | 36 | using Nini.Config; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Servers.HttpServer; | 39 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenMetaverse; | 41 | using OpenMetaverse; |
42 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
43 | 43 | ||
44 | namespace OpenSim.Services.Connectors | 44 | namespace OpenSim.Services.Connectors |
45 | { | 45 | { |
46 | public class NeighbourServicesConnector : INeighbourService | 46 | public class NeighbourServicesConnector : INeighbourService |
47 | { | 47 | { |
48 | private static readonly ILog m_log = | 48 | private static readonly ILog m_log = |
49 | LogManager.GetLogger( | 49 | LogManager.GetLogger( |
50 | MethodBase.GetCurrentMethod().DeclaringType); | 50 | MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | protected IGridServices m_MapService = null; | 52 | protected IGridServices m_MapService = null; |
53 | 53 | ||
54 | public NeighbourServicesConnector() | 54 | public NeighbourServicesConnector() |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | public NeighbourServicesConnector(IGridServices gridServices) | 58 | public NeighbourServicesConnector(IGridServices gridServices) |
59 | { | 59 | { |
60 | Initialise(gridServices); | 60 | Initialise(gridServices); |
61 | } | 61 | } |
62 | 62 | ||
63 | public virtual void Initialise(IGridServices gridServices) | 63 | public virtual void Initialise(IGridServices gridServices) |
64 | { | 64 | { |
65 | m_MapService = gridServices; | 65 | m_MapService = gridServices; |
66 | } | 66 | } |
67 | 67 | ||
68 | public virtual bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 68 | public virtual bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
69 | { | 69 | { |
70 | RegionInfo regInfo = m_MapService.RequestNeighbourInfo(regionHandle); | 70 | RegionInfo regInfo = m_MapService.RequestNeighbourInfo(regionHandle); |
71 | if ((regInfo != null) && | 71 | if ((regInfo != null) && |
72 | // Don't remote-call this instance; that's a startup hickup | 72 | // Don't remote-call this instance; that's a startup hickup |
73 | !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) | 73 | !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) |
74 | { | 74 | { |
75 | return DoHelloNeighbourCall(regInfo, thisRegion); | 75 | return DoHelloNeighbourCall(regInfo, thisRegion); |
76 | } | 76 | } |
77 | //else | 77 | //else |
78 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | 78 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | 81 | ||
82 | public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) | 82 | public bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) |
83 | { | 83 | { |
84 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | 84 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; |
85 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); | 85 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); |
86 | 86 | ||
87 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | 87 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); |
88 | HelloNeighbourRequest.Method = "POST"; | 88 | HelloNeighbourRequest.Method = "POST"; |
89 | HelloNeighbourRequest.ContentType = "application/json"; | 89 | HelloNeighbourRequest.ContentType = "application/json"; |
90 | HelloNeighbourRequest.Timeout = 10000; | 90 | HelloNeighbourRequest.Timeout = 10000; |
91 | 91 | ||
92 | // Fill it in | 92 | // Fill it in |
93 | OSDMap args = null; | 93 | OSDMap args = null; |
94 | try | 94 | try |
95 | { | 95 | { |
96 | args = thisRegion.PackRegionInfoData(); | 96 | args = thisRegion.PackRegionInfoData(); |
97 | } | 97 | } |
98 | catch (Exception e) | 98 | catch (Exception e) |
99 | { | 99 | { |
100 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); | 100 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); |
101 | } | 101 | } |
102 | // Add the regionhandle of the destination region | 102 | // Add the regionhandle of the destination region |
103 | args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString()); | 103 | args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString()); |
104 | 104 | ||
105 | string strBuffer = ""; | 105 | string strBuffer = ""; |
106 | byte[] buffer = new byte[1]; | 106 | byte[] buffer = new byte[1]; |
107 | try | 107 | try |
108 | { | 108 | { |
109 | strBuffer = OSDParser.SerializeJsonString(args); | 109 | strBuffer = OSDParser.SerializeJsonString(args); |
110 | UTF8Encoding str = new UTF8Encoding(); | 110 | UTF8Encoding str = new UTF8Encoding(); |
111 | buffer = str.GetBytes(strBuffer); | 111 | buffer = str.GetBytes(strBuffer); |
112 | 112 | ||
113 | } | 113 | } |
114 | catch (Exception e) | 114 | catch (Exception e) |
115 | { | 115 | { |
116 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); | 116 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); |
117 | // ignore. buffer will be empty, caller should check. | 117 | // ignore. buffer will be empty, caller should check. |
118 | } | 118 | } |
119 | 119 | ||
120 | Stream os = null; | 120 | Stream os = null; |
121 | try | 121 | try |
122 | { // send the Post | 122 | { // send the Post |
123 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send | 123 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send |
124 | os = HelloNeighbourRequest.GetRequestStream(); | 124 | os = HelloNeighbourRequest.GetRequestStream(); |
125 | os.Write(buffer, 0, strBuffer.Length); //Send it | 125 | os.Write(buffer, 0, strBuffer.Length); //Send it |
126 | os.Close(); | 126 | os.Close(); |
127 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); | 127 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); |
128 | } | 128 | } |
129 | //catch (WebException ex) | 129 | //catch (WebException ex) |
130 | catch | 130 | catch |
131 | { | 131 | { |
132 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); | 132 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); |
133 | 133 | ||
134 | return false; | 134 | return false; |
135 | } | 135 | } |
136 | 136 | ||
137 | // Let's wait for the response | 137 | // Let's wait for the response |
138 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | 138 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); |
139 | 139 | ||
140 | try | 140 | try |
141 | { | 141 | { |
142 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); | 142 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); |
143 | if (webResponse == null) | 143 | if (webResponse == null) |
144 | { | 144 | { |
145 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); | 145 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); |
146 | } | 146 | } |
147 | 147 | ||
148 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | 148 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); |
149 | //reply = sr.ReadToEnd().Trim(); | 149 | //reply = sr.ReadToEnd().Trim(); |
150 | sr.ReadToEnd().Trim(); | 150 | sr.ReadToEnd().Trim(); |
151 | sr.Close(); | 151 | sr.Close(); |
152 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | 152 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); |
153 | 153 | ||
154 | } | 154 | } |
155 | catch (WebException ex) | 155 | catch (WebException ex) |
156 | { | 156 | { |
157 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); | 157 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); |
158 | // ignore, really | 158 | // ignore, really |
159 | } | 159 | } |
160 | 160 | ||
161 | return true; | 161 | return true; |
162 | 162 | ||
163 | } | 163 | } |
164 | 164 | ||
165 | } | 165 | } |
166 | } | 166 | } |