aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Neighbour
diff options
context:
space:
mode:
authorDiva Canto2009-10-07 08:42:33 -0700
committerDiva Canto2009-10-07 08:42:33 -0700
commit78e4501bef27c04f317153dcec45346a7f3987ab (patch)
treed73c0cbcc0c58587c3305fda37b91e6afa75155d /OpenSim/Services/Connectors/Neighbour
parentA small change in FetchInventoryDescendantsCAPS. (diff)
downloadopensim-SC-78e4501bef27c04f317153dcec45346a7f3987ab.zip
opensim-SC-78e4501bef27c04f317153dcec45346a7f3987ab.tar.gz
opensim-SC-78e4501bef27c04f317153dcec45346a7f3987ab.tar.bz2
opensim-SC-78e4501bef27c04f317153dcec45346a7f3987ab.tar.xz
Improved fault handling in HelloNeighbour.
Diffstat (limited to 'OpenSim/Services/Connectors/Neighbour')
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs36
1 files changed, 23 insertions, 13 deletions
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 145f212..0a982f8 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -76,10 +76,12 @@ namespace OpenSim.Services.Connectors
76 // Don't remote-call this instance; that's a startup hickup 76 // Don't remote-call this instance; that's a startup hickup
77 !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) 77 !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort)))
78 { 78 {
79 DoHelloNeighbourCall(regInfo, thisRegion); 79 if (!DoHelloNeighbourCall(regInfo, thisRegion))
80 return null;
80 } 81 }
81 //else 82 else
82 // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); 83 return null;
84
83 return regInfo; 85 return regInfo;
84 } 86 }
85 87
@@ -102,6 +104,7 @@ namespace OpenSim.Services.Connectors
102 catch (Exception e) 104 catch (Exception e)
103 { 105 {
104 m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); 106 m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message);
107 return false;
105 } 108 }
106 // Add the regionhandle of the destination region 109 // Add the regionhandle of the destination region
107 args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString()); 110 args["destination_handle"] = OSD.FromString(region.RegionHandle.ToString());
@@ -118,7 +121,7 @@ namespace OpenSim.Services.Connectors
118 catch (Exception e) 121 catch (Exception e)
119 { 122 {
120 m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); 123 m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message);
121 // ignore. buffer will be empty, caller should check. 124 return false;
122 } 125 }
123 126
124 Stream os = null; 127 Stream os = null;
@@ -127,20 +130,23 @@ namespace OpenSim.Services.Connectors
127 HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send 130 HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
128 os = HelloNeighbourRequest.GetRequestStream(); 131 os = HelloNeighbourRequest.GetRequestStream();
129 os.Write(buffer, 0, strBuffer.Length); //Send it 132 os.Write(buffer, 0, strBuffer.Length); //Send it
130 os.Close();
131 //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); 133 //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
132 } 134 }
133 //catch (WebException ex) 135 catch (Exception ex)
134 catch
135 { 136 {
136 //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); 137 m_log.InfoFormat("[REST COMMS]: Unable to send HelloNeighbour to {0}: {1}", region.RegionName, ex.Message);
137
138 return false; 138 return false;
139 } 139 }
140 finally
141 {
142 if (os != null)
143 os.Close();
144 }
140 145
141 // Let's wait for the response 146 // Let's wait for the response
142 //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); 147 //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall");
143 148
149 StreamReader sr = null;
144 try 150 try
145 { 151 {
146 WebResponse webResponse = HelloNeighbourRequest.GetResponse(); 152 WebResponse webResponse = HelloNeighbourRequest.GetResponse();
@@ -149,17 +155,21 @@ namespace OpenSim.Services.Connectors
149 m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); 155 m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post");
150 } 156 }
151 157
152 StreamReader sr = new StreamReader(webResponse.GetResponseStream()); 158 sr = new StreamReader(webResponse.GetResponseStream());
153 //reply = sr.ReadToEnd().Trim(); 159 //reply = sr.ReadToEnd().Trim();
154 sr.ReadToEnd().Trim(); 160 sr.ReadToEnd().Trim();
155 sr.Close();
156 //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); 161 //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
157 162
158 } 163 }
159 catch (WebException ex) 164 catch (Exception ex)
160 { 165 {
161 m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); 166 m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message);
162 // ignore, really 167 return false;
168 }
169 finally
170 {
171 if (sr != null)
172 sr.Close();
163 } 173 }
164 174
165 return true; 175 return true;