aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
diff options
context:
space:
mode:
authorMelanie2011-11-24 01:16:37 +0000
committerMelanie2011-11-24 01:16:37 +0000
commita8270cb48cf8dbca7595da5963d8fafdb1141529 (patch)
treecf878acca0c652239f4441c3783647b6b0b688a6 /OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
parentMerge branch 'master' into bigmerge (diff)
parentAppend asset ID to URL for storage requests to allow caching proxies to work ... (diff)
downloadopensim-SC-a8270cb48cf8dbca7595da5963d8fafdb1141529.zip
opensim-SC-a8270cb48cf8dbca7595da5963d8fafdb1141529.tar.gz
opensim-SC-a8270cb48cf8dbca7595da5963d8fafdb1141529.tar.bz2
opensim-SC-a8270cb48cf8dbca7595da5963d8fafdb1141529.tar.xz
Merge branch 'master' into bigmerge
Diffstat (limited to 'OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs65
1 files changed, 46 insertions, 19 deletions
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 2cae02d..888b072 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -87,12 +87,26 @@ namespace OpenSim.Services.Connectors
87 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) 87 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
88 { 88 {
89 string uri = region.ServerURI + "region/" + thisRegion.RegionID + "/"; 89 string uri = region.ServerURI + "region/" + thisRegion.RegionID + "/";
90 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); 90// m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
91 91
92 WebRequest HelloNeighbourRequest = WebRequest.Create(uri); 92 WebRequest helloNeighbourRequest;
93 HelloNeighbourRequest.Method = "POST"; 93
94 HelloNeighbourRequest.ContentType = "application/json"; 94 try
95 HelloNeighbourRequest.Timeout = 10000; 95 {
96 helloNeighbourRequest = WebRequest.Create(uri);
97 }
98 catch (Exception e)
99 {
100 m_log.WarnFormat(
101 "[NEIGHBOUR SERVICE CONNCTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}",
102 uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
103
104 return false;
105 }
106
107 helloNeighbourRequest.Method = "POST";
108 helloNeighbourRequest.ContentType = "application/json";
109 helloNeighbourRequest.Timeout = 10000;
96 110
97 // Fill it in 111 // Fill it in
98 OSDMap args = null; 112 OSDMap args = null;
@@ -102,38 +116,48 @@ namespace OpenSim.Services.Connectors
102 } 116 }
103 catch (Exception e) 117 catch (Exception e)
104 { 118 {
105 m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); 119 m_log.WarnFormat(
120 "[NEIGHBOUR SERVICE CONNCTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}",
121 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
122
106 return false; 123 return false;
107 } 124 }
125
108 // Add the regionhandle of the destination region 126 // Add the regionhandle of the destination region
109 args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString()); 127 args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString());
110 128
111 string strBuffer = ""; 129 string strBuffer = "";
112 byte[] buffer = new byte[1]; 130 byte[] buffer = new byte[1];
131
113 try 132 try
114 { 133 {
115 strBuffer = OSDParser.SerializeJsonString(args); 134 strBuffer = OSDParser.SerializeJsonString(args);
116 UTF8Encoding str = new UTF8Encoding(); 135 UTF8Encoding str = new UTF8Encoding();
117 buffer = str.GetBytes(strBuffer); 136 buffer = str.GetBytes(strBuffer);
118
119 } 137 }
120 catch (Exception e) 138 catch (Exception e)
121 { 139 {
122 m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); 140 m_log.WarnFormat(
141 "[NEIGHBOUR SERVICE CONNCTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}",
142 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
143
123 return false; 144 return false;
124 } 145 }
125 146
126 Stream os = null; 147 Stream os = null;
127 try 148 try
128 { // send the Post 149 { // send the Post
129 HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send 150 helloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
130 os = HelloNeighbourRequest.GetRequestStream(); 151 os = helloNeighbourRequest.GetRequestStream();
131 os.Write(buffer, 0, strBuffer.Length); //Send it 152 os.Write(buffer, 0, strBuffer.Length); //Send it
132 //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); 153 //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
133 } 154 }
134 catch (Exception ex) 155 catch (Exception e)
135 { 156 {
136 m_log.InfoFormat("[REST COMMS]: Unable to send HelloNeighbour to {0}: {1}", region.RegionName, ex.Message); 157 m_log.WarnFormat(
158 "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}",
159 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
160
137 return false; 161 return false;
138 } 162 }
139 finally 163 finally
@@ -148,10 +172,12 @@ namespace OpenSim.Services.Connectors
148 StreamReader sr = null; 172 StreamReader sr = null;
149 try 173 try
150 { 174 {
151 WebResponse webResponse = HelloNeighbourRequest.GetResponse(); 175 WebResponse webResponse = helloNeighbourRequest.GetResponse();
152 if (webResponse == null) 176 if (webResponse == null)
153 { 177 {
154 m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); 178 m_log.DebugFormat(
179 "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}",
180 thisRegion.RegionName, region.RegionName);
155 } 181 }
156 182
157 sr = new StreamReader(webResponse.GetResponseStream()); 183 sr = new StreamReader(webResponse.GetResponseStream());
@@ -160,9 +186,12 @@ namespace OpenSim.Services.Connectors
160 //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); 186 //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
161 187
162 } 188 }
163 catch (Exception ex) 189 catch (Exception e)
164 { 190 {
165 m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); 191 m_log.WarnFormat(
192 "[NEIGHBOUR SERVICE CONNCTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}",
193 region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace);
194
166 return false; 195 return false;
167 } 196 }
168 finally 197 finally
@@ -172,8 +201,6 @@ namespace OpenSim.Services.Connectors
172 } 201 }
173 202
174 return true; 203 return true;
175
176 } 204 }
177
178 } 205 }
179} 206} \ No newline at end of file