diff options
Diffstat (limited to 'OpenSim')
35 files changed, 705 insertions, 295 deletions
diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs index aabb02c..0a21328 100644 --- a/OpenSim/ConsoleClient/Requester.cs +++ b/OpenSim/ConsoleClient/Requester.cs | |||
@@ -44,7 +44,6 @@ namespace OpenSim.ConsoleClient | |||
44 | ReplyDelegate action) | 44 | ReplyDelegate action) |
45 | { | 45 | { |
46 | WebRequest request = WebRequest.Create(requestUrl); | 46 | WebRequest request = WebRequest.Create(requestUrl); |
47 | WebResponse response = null; | ||
48 | 47 | ||
49 | request.Method = "POST"; | 48 | request.Method = "POST"; |
50 | 49 | ||
@@ -64,16 +63,18 @@ namespace OpenSim.ConsoleClient | |||
64 | { | 63 | { |
65 | string reply = String.Empty; | 64 | string reply = String.Empty; |
66 | 65 | ||
67 | response = request.EndGetResponse(ar); | 66 | using (WebResponse response = request.EndGetResponse(ar)) |
68 | |||
69 | try | ||
70 | { | 67 | { |
71 | StreamReader r = new StreamReader(response.GetResponseStream()); | 68 | try |
72 | reply = r.ReadToEnd(); | 69 | { |
70 | using (Stream s = response.GetResponseStream()) | ||
71 | using (StreamReader r = new StreamReader(s)) | ||
72 | reply = r.ReadToEnd(); | ||
73 | 73 | ||
74 | } | 74 | } |
75 | catch (System.InvalidOperationException) | 75 | catch (System.InvalidOperationException) |
76 | { | 76 | { |
77 | } | ||
77 | } | 78 | } |
78 | 79 | ||
79 | action(requestUrl, data, reply); | 80 | action(requestUrl, data, reply); |
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index c7488d8..f3e008d 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -163,14 +163,18 @@ namespace OpenSim.Data.MSSQL | |||
163 | if (asset.Name.Length > 64) | 163 | if (asset.Name.Length > 64) |
164 | { | 164 | { |
165 | assetName = asset.Name.Substring(0, 64); | 165 | assetName = asset.Name.Substring(0, 64); |
166 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 166 | m_log.WarnFormat( |
167 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
168 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
167 | } | 169 | } |
168 | 170 | ||
169 | string assetDescription = asset.Description; | 171 | string assetDescription = asset.Description; |
170 | if (asset.Description.Length > 64) | 172 | if (asset.Description.Length > 64) |
171 | { | 173 | { |
172 | assetDescription = asset.Description.Substring(0, 64); | 174 | assetDescription = asset.Description.Substring(0, 64); |
173 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 175 | m_log.WarnFormat( |
176 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
177 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
174 | } | 178 | } |
175 | 179 | ||
176 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 180 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 73de64b..cf80b3d 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -173,14 +173,18 @@ namespace OpenSim.Data.MySQL | |||
173 | if (asset.Name.Length > 64) | 173 | if (asset.Name.Length > 64) |
174 | { | 174 | { |
175 | assetName = asset.Name.Substring(0, 64); | 175 | assetName = asset.Name.Substring(0, 64); |
176 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 176 | m_log.WarnFormat( |
177 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
178 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
177 | } | 179 | } |
178 | 180 | ||
179 | string assetDescription = asset.Description; | 181 | string assetDescription = asset.Description; |
180 | if (asset.Description.Length > 64) | 182 | if (asset.Description.Length > 64) |
181 | { | 183 | { |
182 | assetDescription = asset.Description.Substring(0, 64); | 184 | assetDescription = asset.Description.Substring(0, 64); |
183 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 185 | m_log.WarnFormat( |
186 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
187 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
184 | } | 188 | } |
185 | 189 | ||
186 | try | 190 | try |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index e6ac22e..c2282c8 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -204,14 +204,18 @@ namespace OpenSim.Data.MySQL | |||
204 | if (asset.Name.Length > 64) | 204 | if (asset.Name.Length > 64) |
205 | { | 205 | { |
206 | assetName = asset.Name.Substring(0, 64); | 206 | assetName = asset.Name.Substring(0, 64); |
207 | m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 207 | m_log.WarnFormat( |
208 | "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
209 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
208 | } | 210 | } |
209 | 211 | ||
210 | string assetDescription = asset.Description; | 212 | string assetDescription = asset.Description; |
211 | if (asset.Description.Length > 64) | 213 | if (asset.Description.Length > 64) |
212 | { | 214 | { |
213 | assetDescription = asset.Description.Substring(0, 64); | 215 | assetDescription = asset.Description.Substring(0, 64); |
214 | m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 216 | m_log.WarnFormat( |
217 | "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
218 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
215 | } | 219 | } |
216 | 220 | ||
217 | if (m_enableCompression) | 221 | if (m_enableCompression) |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 61e7aaf..c32982e 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Data.SQLite | |||
46 | /// </summary> | 46 | /// </summary> |
47 | public class SQLiteAssetData : AssetDataBase | 47 | public class SQLiteAssetData : AssetDataBase |
48 | { | 48 | { |
49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; | 51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; |
52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; | 52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; |
@@ -133,6 +133,24 @@ namespace OpenSim.Data.SQLite | |||
133 | /// <param name="asset">Asset Base</param> | 133 | /// <param name="asset">Asset Base</param> |
134 | override public void StoreAsset(AssetBase asset) | 134 | override public void StoreAsset(AssetBase asset) |
135 | { | 135 | { |
136 | string assetName = asset.Name; | ||
137 | if (asset.Name.Length > 64) | ||
138 | { | ||
139 | assetName = asset.Name.Substring(0, 64); | ||
140 | m_log.WarnFormat( | ||
141 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
142 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
143 | } | ||
144 | |||
145 | string assetDescription = asset.Description; | ||
146 | if (asset.Description.Length > 64) | ||
147 | { | ||
148 | assetDescription = asset.Description.Substring(0, 64); | ||
149 | m_log.WarnFormat( | ||
150 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
151 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
152 | } | ||
153 | |||
136 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 154 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
137 | if (ExistsAsset(asset.FullID)) | 155 | if (ExistsAsset(asset.FullID)) |
138 | { | 156 | { |
@@ -143,8 +161,8 @@ namespace OpenSim.Data.SQLite | |||
143 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | 161 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) |
144 | { | 162 | { |
145 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 163 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
146 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 164 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
147 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 165 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
148 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 166 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
149 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 167 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
150 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 168 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
@@ -163,8 +181,8 @@ namespace OpenSim.Data.SQLite | |||
163 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | 181 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) |
164 | { | 182 | { |
165 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 183 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
166 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 184 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
167 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 185 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
168 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 186 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
169 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 187 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
170 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 188 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 3dce578..6681c37 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | |||
@@ -65,23 +65,27 @@ namespace OpenSim.Framework.Configuration.HTTP | |||
65 | byte[] buf = new byte[8192]; | 65 | byte[] buf = new byte[8192]; |
66 | HttpWebRequest request = | 66 | HttpWebRequest request = |
67 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); | 67 | (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); |
68 | HttpWebResponse response = (HttpWebResponse) request.GetResponse(); | 68 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) |
69 | |||
70 | Stream resStream = response.GetResponseStream(); | ||
71 | |||
72 | string tempString = null; | ||
73 | int count = 0; | ||
74 | |||
75 | do | ||
76 | { | 69 | { |
77 | count = resStream.Read(buf, 0, buf.Length); | 70 | using (Stream resStream = response.GetResponseStream()) |
78 | if (count != 0) | ||
79 | { | 71 | { |
80 | tempString = Util.UTF8.GetString(buf, 0, count); | 72 | string tempString = null; |
81 | sb.Append(tempString); | 73 | int count = 0; |
74 | |||
75 | do | ||
76 | { | ||
77 | count = resStream.Read(buf, 0, buf.Length); | ||
78 | if (count != 0) | ||
79 | { | ||
80 | tempString = Util.UTF8.GetString(buf, 0, count); | ||
81 | sb.Append(tempString); | ||
82 | } | ||
83 | } | ||
84 | while (count > 0); | ||
85 | |||
86 | LoadDataFromString(sb.ToString()); | ||
82 | } | 87 | } |
83 | } while (count > 0); | 88 | } |
84 | LoadDataFromString(sb.ToString()); | ||
85 | } | 89 | } |
86 | catch (WebException) | 90 | catch (WebException) |
87 | { | 91 | { |
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index a2f5d9c..05c64fa 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | |||
@@ -74,16 +74,26 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
74 | 74 | ||
75 | try | 75 | try |
76 | { | 76 | { |
77 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); | ||
78 | m_log.Debug("[WEBLOADER]: Downloading region information..."); | ||
79 | StreamReader reader = new StreamReader(webResponse.GetResponseStream()); | ||
80 | string xmlSource = String.Empty; | 77 | string xmlSource = String.Empty; |
81 | string tempStr = reader.ReadLine(); | 78 | |
82 | while (tempStr != null) | 79 | using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse()) |
83 | { | 80 | { |
84 | xmlSource = xmlSource + tempStr; | 81 | m_log.Debug("[WEBLOADER]: Downloading region information..."); |
85 | tempStr = reader.ReadLine(); | 82 | |
83 | using (Stream s = webResponse.GetResponseStream()) | ||
84 | { | ||
85 | using (StreamReader reader = new StreamReader(s)) | ||
86 | { | ||
87 | string tempStr = reader.ReadLine(); | ||
88 | while (tempStr != null) | ||
89 | { | ||
90 | xmlSource = xmlSource + tempStr; | ||
91 | tempStr = reader.ReadLine(); | ||
92 | } | ||
93 | } | ||
94 | } | ||
86 | } | 95 | } |
96 | |||
87 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + | 97 | m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + |
88 | xmlSource.Length); | 98 | xmlSource.Length); |
89 | XmlDocument xmlDoc = new XmlDocument(); | 99 | XmlDocument xmlDoc = new XmlDocument(); |
@@ -107,17 +117,24 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
107 | } | 117 | } |
108 | catch (WebException ex) | 118 | catch (WebException ex) |
109 | { | 119 | { |
110 | if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) | 120 | using (HttpWebResponse response = (HttpWebResponse)ex.Response) |
111 | { | 121 | { |
112 | if (!allowRegionless) | 122 | if (response.StatusCode == HttpStatusCode.NotFound) |
123 | { | ||
124 | if (!allowRegionless) | ||
125 | throw ex; | ||
126 | } | ||
127 | else | ||
128 | { | ||
113 | throw ex; | 129 | throw ex; |
130 | } | ||
114 | } | 131 | } |
115 | else | ||
116 | throw ex; | ||
117 | } | 132 | } |
118 | 133 | ||
119 | if (regionCount > 0 | allowRegionless) | 134 | if (regionCount > 0 | allowRegionless) |
135 | { | ||
120 | return regionInfos; | 136 | return regionInfos; |
137 | } | ||
121 | else | 138 | else |
122 | { | 139 | { |
123 | m_log.Error("[WEBLOADER]: No region configs were available."); | 140 | m_log.Error("[WEBLOADER]: No region configs were available."); |
@@ -127,4 +144,4 @@ namespace OpenSim.Framework.RegionLoader.Web | |||
127 | } | 144 | } |
128 | } | 145 | } |
129 | } | 146 | } |
130 | } | 147 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 19c03a8..edcd134 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -101,20 +101,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
101 | using (WebResponse resp = request.GetResponse()) | 101 | using (WebResponse resp = request.GetResponse()) |
102 | { | 102 | { |
103 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 103 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
104 | Stream respStream = null; | 104 | |
105 | try | 105 | using (Stream respStream = resp.GetResponseStream()) |
106 | { | ||
107 | respStream = resp.GetResponseStream(); | ||
108 | deserial = (TResponse)deserializer.Deserialize(respStream); | 106 | deserial = (TResponse)deserializer.Deserialize(respStream); |
109 | } | ||
110 | catch { } | ||
111 | finally | ||
112 | { | ||
113 | if (respStream != null) | ||
114 | respStream.Close(); | ||
115 | resp.Close(); | ||
116 | } | ||
117 | } | 107 | } |
108 | |||
118 | return deserial; | 109 | return deserial; |
119 | } | 110 | } |
120 | } | 111 | } |
diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index 293887f..cfd34bb 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs | |||
@@ -227,9 +227,12 @@ namespace OpenSim.Framework.Servers | |||
227 | handlers.AppendFormat("\t{0}\n", s); | 227 | handlers.AppendFormat("\t{0}\n", s); |
228 | 228 | ||
229 | handlers.AppendFormat("* HTTP:\n"); | 229 | handlers.AppendFormat("* HTTP:\n"); |
230 | List<String> poll = httpServer.GetPollServiceHandlerKeys(); | ||
231 | foreach (String s in httpServer.GetHTTPHandlerKeys()) | 230 | foreach (String s in httpServer.GetHTTPHandlerKeys()) |
232 | handlers.AppendFormat("\t{0} {1}\n", s, (poll.Contains(s) ? "(poll service)" : string.Empty)); | 231 | handlers.AppendFormat("\t{0}\n", s); |
232 | |||
233 | handlers.AppendFormat("* HTTP (poll):\n"); | ||
234 | foreach (String s in httpServer.GetPollServiceHandlerKeys()) | ||
235 | handlers.AppendFormat("\t{0}\n", s); | ||
233 | 236 | ||
234 | handlers.AppendFormat("* JSONRPC:\n"); | 237 | handlers.AppendFormat("* JSONRPC:\n"); |
235 | foreach (String s in httpServer.GetJsonRpcHandlerKeys()) | 238 | foreach (String s in httpServer.GetJsonRpcHandlerKeys()) |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 5c34cf4..701fbb0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -228,8 +228,8 @@ namespace OpenSim.Framework | |||
228 | errorMessage = we.Message; | 228 | errorMessage = we.Message; |
229 | if (we.Status == WebExceptionStatus.ProtocolError) | 229 | if (we.Status == WebExceptionStatus.ProtocolError) |
230 | { | 230 | { |
231 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | 231 | using (HttpWebResponse webResponse = (HttpWebResponse)we.Response) |
232 | errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); | 232 | errorMessage = String.Format("[{0}] {1}", webResponse.StatusCode, webResponse.StatusDescription); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | catch (Exception ex) | 235 | catch (Exception ex) |
@@ -387,8 +387,8 @@ namespace OpenSim.Framework | |||
387 | errorMessage = we.Message; | 387 | errorMessage = we.Message; |
388 | if (we.Status == WebExceptionStatus.ProtocolError) | 388 | if (we.Status == WebExceptionStatus.ProtocolError) |
389 | { | 389 | { |
390 | HttpWebResponse webResponse = (HttpWebResponse)we.Response; | 390 | using (HttpWebResponse webResponse = (HttpWebResponse)we.Response) |
391 | errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); | 391 | errorMessage = String.Format("[{0}] {1}",webResponse.StatusCode,webResponse.StatusDescription); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | catch (Exception ex) | 394 | catch (Exception ex) |
@@ -834,15 +834,16 @@ namespace OpenSim.Framework | |||
834 | { | 834 | { |
835 | if (e.Response is HttpWebResponse) | 835 | if (e.Response is HttpWebResponse) |
836 | { | 836 | { |
837 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; | 837 | using (HttpWebResponse httpResponse = (HttpWebResponse)e.Response) |
838 | 838 | { | |
839 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | 839 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) |
840 | { | 840 | { |
841 | // We don't appear to be handling any other status codes, so log these feailures to that | 841 | // We don't appear to be handling any other status codes, so log these feailures to that |
842 | // people don't spend unnecessary hours hunting phantom bugs. | 842 | // people don't spend unnecessary hours hunting phantom bugs. |
843 | m_log.DebugFormat( | 843 | m_log.DebugFormat( |
844 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | 844 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", |
845 | verb, requestUrl, httpResponse.StatusCode); | 845 | verb, requestUrl, httpResponse.StatusCode); |
846 | } | ||
846 | } | 847 | } |
847 | } | 848 | } |
848 | } | 849 | } |
@@ -983,11 +984,9 @@ namespace OpenSim.Framework | |||
983 | Stream respStream = null; | 984 | Stream respStream = null; |
984 | try | 985 | try |
985 | { | 986 | { |
986 | respStream = resp.GetResponseStream(); | 987 | using (respStream = resp.GetResponseStream()) |
987 | using (StreamReader reader = new StreamReader(respStream)) | 988 | using (StreamReader reader = new StreamReader(respStream)) |
988 | { | 989 | respstring = reader.ReadToEnd(); |
989 | respstring = reader.ReadToEnd(); | ||
990 | } | ||
991 | } | 990 | } |
992 | catch (Exception e) | 991 | catch (Exception e) |
993 | { | 992 | { |
@@ -1127,10 +1126,11 @@ namespace OpenSim.Framework | |||
1127 | { | 1126 | { |
1128 | if (resp.ContentLength != 0) | 1127 | if (resp.ContentLength != 0) |
1129 | { | 1128 | { |
1130 | Stream respStream = resp.GetResponseStream(); | 1129 | using (Stream respStream = resp.GetResponseStream()) |
1131 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 1130 | { |
1132 | deserial = (TResponse)deserializer.Deserialize(respStream); | 1131 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
1133 | respStream.Close(); | 1132 | deserial = (TResponse)deserializer.Deserialize(respStream); |
1133 | } | ||
1134 | } | 1134 | } |
1135 | else | 1135 | else |
1136 | { | 1136 | { |
@@ -1142,14 +1142,15 @@ namespace OpenSim.Framework | |||
1142 | } | 1142 | } |
1143 | catch (WebException e) | 1143 | catch (WebException e) |
1144 | { | 1144 | { |
1145 | HttpWebResponse hwr = (HttpWebResponse)e.Response; | 1145 | using (HttpWebResponse hwr = (HttpWebResponse)e.Response) |
1146 | 1146 | { | |
1147 | if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) | 1147 | if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound) |
1148 | return deserial; | 1148 | return deserial; |
1149 | else | 1149 | else |
1150 | m_log.ErrorFormat( | 1150 | m_log.ErrorFormat( |
1151 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", | 1151 | "[SynchronousRestObjectRequester]: WebException for {0} {1} {2}: {3} {4}", |
1152 | verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); | 1152 | verb, requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace); |
1153 | } | ||
1153 | } | 1154 | } |
1154 | catch (System.InvalidOperationException) | 1155 | catch (System.InvalidOperationException) |
1155 | { | 1156 | { |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index c4731a3..4075edb 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Linq; | ||
33 | using System.Reflection; | 34 | using System.Reflection; |
34 | using System.Text; | 35 | using System.Text; |
35 | using System.Text.RegularExpressions; | 36 | using System.Text.RegularExpressions; |
@@ -808,16 +809,28 @@ namespace OpenSim | |||
808 | break; | 809 | break; |
809 | 810 | ||
810 | case "modules": | 811 | case "modules": |
811 | SceneManager.ForEachScene( | 812 | SceneManager.ForEachSelectedScene( |
812 | delegate(Scene scene) { | 813 | scene => |
813 | MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); | ||
814 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
815 | { | 814 | { |
816 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | 815 | MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name); |
817 | string module_type = type != null ? "Shared" : "Non-Shared"; | 816 | |
818 | MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); | 817 | List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>(); |
818 | List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>(); | ||
819 | |||
820 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
821 | { | ||
822 | if (module.GetType().GetInterface("ISharedRegionModule") != null) | ||
823 | nonSharedModules.Add(module); | ||
824 | else | ||
825 | sharedModules.Add(module); | ||
826 | } | ||
827 | |||
828 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
829 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); | ||
830 | |||
831 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
832 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); | ||
819 | } | 833 | } |
820 | } | ||
821 | ); | 834 | ); |
822 | 835 | ||
823 | MainConsole.Instance.Output(""); | 836 | MainConsole.Instance.Output(""); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3c8e199..c555915 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -668,7 +668,7 @@ namespace OpenSim | |||
668 | // listenIP = IPAddress.Parse("0.0.0.0"); | 668 | // listenIP = IPAddress.Parse("0.0.0.0"); |
669 | 669 | ||
670 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 670 | uint port = (uint) regionInfo.InternalEndPoint.Port; |
671 | IClientNetworkServer clientNetworkServer; | 671 | |
672 | if (m_autoCreateClientStack) | 672 | if (m_autoCreateClientStack) |
673 | { | 673 | { |
674 | clientNetworkServers = m_clientStackManager.CreateServers( | 674 | clientNetworkServers = m_clientStackManager.CreateServers( |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index be617a5..c9cd412 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -117,20 +117,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
117 | /// </summary> | 117 | /// </summary> |
118 | private Dictionary<string, UrlData> m_UrlMap = new Dictionary<string, UrlData>(); | 118 | private Dictionary<string, UrlData> m_UrlMap = new Dictionary<string, UrlData>(); |
119 | 119 | ||
120 | /// <summary> | 120 | private uint m_HttpsPort = 0; |
121 | /// Maximum number of external urls that can be set up by this module. | ||
122 | /// </summary> | ||
123 | private int m_TotalUrls = 100; | ||
124 | |||
125 | private uint https_port = 0; | ||
126 | private IHttpServer m_HttpServer = null; | 121 | private IHttpServer m_HttpServer = null; |
127 | private IHttpServer m_HttpsServer = null; | 122 | private IHttpServer m_HttpsServer = null; |
128 | 123 | ||
129 | private string m_ExternalHostNameForLSL = ""; | 124 | public string ExternalHostNameForLSL { get; private set; } |
130 | public string ExternalHostNameForLSL | 125 | |
131 | { | 126 | /// <summary> |
132 | get { return m_ExternalHostNameForLSL; } | 127 | /// The default maximum number of urls |
133 | } | 128 | /// </summary> |
129 | public const int DefaultTotalUrls = 100; | ||
130 | |||
131 | /// <summary> | ||
132 | /// Maximum number of external urls that can be set up by this module. | ||
133 | /// </summary> | ||
134 | public int TotalUrls { get; set; } | ||
134 | 135 | ||
135 | public Type ReplaceableInterface | 136 | public Type ReplaceableInterface |
136 | { | 137 | { |
@@ -144,16 +145,27 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
144 | 145 | ||
145 | public void Initialise(IConfigSource config) | 146 | public void Initialise(IConfigSource config) |
146 | { | 147 | { |
147 | m_ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", System.Environment.MachineName); | 148 | IConfig networkConfig = config.Configs["Network"]; |
148 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener",false); | 149 | |
150 | if (networkConfig != null) | ||
151 | { | ||
152 | ExternalHostNameForLSL = config.Configs["Network"].GetString("ExternalHostNameForLSL", null); | ||
153 | |||
154 | bool ssl_enabled = config.Configs["Network"].GetBoolean("https_listener", false); | ||
155 | |||
156 | if (ssl_enabled) | ||
157 | m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort); | ||
158 | } | ||
149 | 159 | ||
150 | if (ssl_enabled) | 160 | if (ExternalHostNameForLSL == null) |
151 | https_port = (uint) config.Configs["Network"].GetInt("https_port",0); | 161 | ExternalHostNameForLSL = System.Environment.MachineName; |
152 | 162 | ||
153 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; | 163 | IConfig llFunctionsConfig = config.Configs["LL-Functions"]; |
154 | 164 | ||
155 | if (llFunctionsConfig != null) | 165 | if (llFunctionsConfig != null) |
156 | m_TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", m_TotalUrls); | 166 | TotalUrls = llFunctionsConfig.GetInt("max_external_urls_per_simulator", DefaultTotalUrls); |
167 | else | ||
168 | TotalUrls = DefaultTotalUrls; | ||
157 | } | 169 | } |
158 | 170 | ||
159 | public void PostInitialise() | 171 | public void PostInitialise() |
@@ -169,9 +181,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
169 | m_HttpServer = MainServer.Instance; | 181 | m_HttpServer = MainServer.Instance; |
170 | // | 182 | // |
171 | // We can use the https if it is enabled | 183 | // We can use the https if it is enabled |
172 | if (https_port > 0) | 184 | if (m_HttpsPort > 0) |
173 | { | 185 | { |
174 | m_HttpsServer = MainServer.GetHttpServer(https_port); | 186 | m_HttpsServer = MainServer.GetHttpServer(m_HttpsPort); |
175 | } | 187 | } |
176 | } | 188 | } |
177 | 189 | ||
@@ -204,12 +216,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
204 | 216 | ||
205 | lock (m_UrlMap) | 217 | lock (m_UrlMap) |
206 | { | 218 | { |
207 | if (m_UrlMap.Count >= m_TotalUrls) | 219 | if (m_UrlMap.Count >= TotalUrls) |
208 | { | 220 | { |
209 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 221 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
210 | return urlcode; | 222 | return urlcode; |
211 | } | 223 | } |
212 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 224 | string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; |
213 | 225 | ||
214 | UrlData urlData = new UrlData(); | 226 | UrlData urlData = new UrlData(); |
215 | urlData.hostID = host.UUID; | 227 | urlData.hostID = host.UUID; |
@@ -249,12 +261,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
249 | 261 | ||
250 | lock (m_UrlMap) | 262 | lock (m_UrlMap) |
251 | { | 263 | { |
252 | if (m_UrlMap.Count >= m_TotalUrls) | 264 | if (m_UrlMap.Count >= TotalUrls) |
253 | { | 265 | { |
254 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 266 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
255 | return urlcode; | 267 | return urlcode; |
256 | } | 268 | } |
257 | string url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; | 269 | string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/"; |
258 | 270 | ||
259 | UrlData urlData = new UrlData(); | 271 | UrlData urlData = new UrlData(); |
260 | urlData.hostID = host.UUID; | 272 | urlData.hostID = host.UUID; |
@@ -377,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
377 | public int GetFreeUrls() | 389 | public int GetFreeUrls() |
378 | { | 390 | { |
379 | lock (m_UrlMap) | 391 | lock (m_UrlMap) |
380 | return m_TotalUrls - m_UrlMap.Count; | 392 | return TotalUrls - m_UrlMap.Count; |
381 | } | 393 | } |
382 | 394 | ||
383 | public void ScriptRemoved(UUID itemID) | 395 | public void ScriptRemoved(UUID itemID) |
@@ -579,9 +591,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
579 | string url; | 591 | string url; |
580 | 592 | ||
581 | if (is_ssl) | 593 | if (is_ssl) |
582 | url = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; | 594 | url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; |
583 | else | 595 | else |
584 | url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; | 596 | url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; |
585 | 597 | ||
586 | // Avoid a race - the request URL may have been released via llRequestUrl() whilst this | 598 | // Avoid a race - the request URL may have been released via llRequestUrl() whilst this |
587 | // request was being processed. | 599 | // request was being processed. |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 689e8a7..f04fabe 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -838,13 +838,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
838 | try | 838 | try |
839 | { | 839 | { |
840 | WebRequest request = HttpWebRequest.Create(url); | 840 | WebRequest request = HttpWebRequest.Create(url); |
841 | //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. | 841 | |
842 | //Ckrinke Stream str = null; | 842 | using (HttpWebResponse response = (HttpWebResponse)(request).GetResponse()) |
843 | HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); | ||
844 | if (response.StatusCode == HttpStatusCode.OK) | ||
845 | { | 843 | { |
846 | Bitmap image = new Bitmap(response.GetResponseStream()); | 844 | if (response.StatusCode == HttpStatusCode.OK) |
847 | return image; | 845 | { |
846 | using (Stream s = response.GetResponseStream()) | ||
847 | { | ||
848 | Bitmap image = new Bitmap(s); | ||
849 | return image; | ||
850 | } | ||
851 | } | ||
848 | } | 852 | } |
849 | } | 853 | } |
850 | catch { } | 854 | catch { } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 912d50a..c50ab64 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -868,20 +868,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
868 | } | 868 | } |
869 | 869 | ||
870 | string response_mapItems_reply = null; | 870 | string response_mapItems_reply = null; |
871 | { // get the response | 871 | { |
872 | StreamReader sr = null; | ||
873 | try | 872 | try |
874 | { | 873 | { |
875 | WebResponse webResponse = mapitemsrequest.GetResponse(); | 874 | using (WebResponse webResponse = mapitemsrequest.GetResponse()) |
876 | if (webResponse != null) | ||
877 | { | ||
878 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
879 | response_mapItems_reply = sr.ReadToEnd().Trim(); | ||
880 | } | ||
881 | else | ||
882 | { | 875 | { |
883 | return new OSDMap(); | 876 | if (webResponse != null) |
884 | } | 877 | { |
878 | using (Stream s = webResponse.GetResponseStream()) | ||
879 | using (StreamReader sr = new StreamReader(s)) | ||
880 | response_mapItems_reply = sr.ReadToEnd().Trim(); | ||
881 | } | ||
882 | else | ||
883 | { | ||
884 | return new OSDMap(); | ||
885 | } | ||
886 | } | ||
885 | } | 887 | } |
886 | catch (WebException) | 888 | catch (WebException) |
887 | { | 889 | { |
@@ -908,11 +910,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
908 | 910 | ||
909 | return responseMap; | 911 | return responseMap; |
910 | } | 912 | } |
911 | finally | ||
912 | { | ||
913 | if (sr != null) | ||
914 | sr.Close(); | ||
915 | } | ||
916 | 913 | ||
917 | OSD rezResponse = null; | 914 | OSD rezResponse = null; |
918 | try | 915 | try |
@@ -926,6 +923,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
926 | { | 923 | { |
927 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); | 924 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); |
928 | responseMap["connect"] = OSD.FromBoolean(false); | 925 | responseMap["connect"] = OSD.FromBoolean(false); |
926 | |||
929 | lock (m_blacklistedregions) | 927 | lock (m_blacklistedregions) |
930 | { | 928 | { |
931 | if (!m_blacklistedregions.ContainsKey(regionhandle)) | 929 | if (!m_blacklistedregions.ContainsKey(regionhandle)) |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 143af48..ced4e91 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -52,7 +52,18 @@ namespace OpenSim.Region.Framework.Interfaces | |||
52 | string GetXMLState(UUID itemID); | 52 | string GetXMLState(UUID itemID); |
53 | bool SetXMLState(UUID itemID, string xml); | 53 | bool SetXMLState(UUID itemID, string xml); |
54 | 54 | ||
55 | /// <summary> | ||
56 | /// Post a script event to a single script. | ||
57 | /// </summary> | ||
58 | /// <returns>true if the post suceeded, false if it did not</returns> | ||
59 | /// <param name='itemID'>The item ID of the script.</param> | ||
60 | /// <param name='name'>The name of the event.</param> | ||
61 | /// <param name='args'> | ||
62 | /// The arguments of the event. These are in the order in which they appear. | ||
63 | /// e.g. for http_request this will be an object array of key request_id, string method, string body | ||
64 | /// </param> | ||
55 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 65 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
66 | |||
56 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 67 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
57 | 68 | ||
58 | /// <summary> | 69 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 1e2e973..780bd01 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -331,35 +331,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
331 | 331 | ||
332 | public void SendCommandToPluginModules(string[] cmdparams) | 332 | public void SendCommandToPluginModules(string[] cmdparams) |
333 | { | 333 | { |
334 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 334 | ForEachSelectedScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
335 | } | 335 | } |
336 | 336 | ||
337 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 337 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
338 | { | 338 | { |
339 | ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); | 339 | ForEachSelectedScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); |
340 | } | 340 | } |
341 | 341 | ||
342 | private void ForEachCurrentScene(Action<Scene> func) | 342 | public void ForEachSelectedScene(Action<Scene> func) |
343 | { | 343 | { |
344 | if (CurrentScene == null) | 344 | if (CurrentScene == null) |
345 | { | 345 | ForEachScene(func); |
346 | lock (m_localScenes) | ||
347 | m_localScenes.ForEach(func); | ||
348 | } | ||
349 | else | 346 | else |
350 | { | ||
351 | func(CurrentScene); | 347 | func(CurrentScene); |
352 | } | ||
353 | } | 348 | } |
354 | 349 | ||
355 | public void RestartCurrentScene() | 350 | public void RestartCurrentScene() |
356 | { | 351 | { |
357 | ForEachCurrentScene(delegate(Scene scene) { scene.RestartNow(); }); | 352 | ForEachSelectedScene(delegate(Scene scene) { scene.RestartNow(); }); |
358 | } | 353 | } |
359 | 354 | ||
360 | public void BackupCurrentScene() | 355 | public void BackupCurrentScene() |
361 | { | 356 | { |
362 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); }); | 357 | ForEachSelectedScene(delegate(Scene scene) { scene.Backup(true); }); |
363 | } | 358 | } |
364 | 359 | ||
365 | public bool TrySetCurrentScene(string regionName) | 360 | public bool TrySetCurrentScene(string regionName) |
@@ -490,7 +485,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
490 | /// <param name="name">Name of avatar to debug</param> | 485 | /// <param name="name">Name of avatar to debug</param> |
491 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) | 486 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) |
492 | { | 487 | { |
493 | ForEachCurrentScene(scene => | 488 | ForEachSelectedScene(scene => |
494 | scene.ForEachScenePresence(sp => | 489 | scene.ForEachScenePresence(sp => |
495 | { | 490 | { |
496 | if (name == null || sp.Name == name) | 491 | if (name == null || sp.Name == name) |
@@ -509,7 +504,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
509 | { | 504 | { |
510 | List<ScenePresence> avatars = new List<ScenePresence>(); | 505 | List<ScenePresence> avatars = new List<ScenePresence>(); |
511 | 506 | ||
512 | ForEachCurrentScene( | 507 | ForEachSelectedScene( |
513 | delegate(Scene scene) | 508 | delegate(Scene scene) |
514 | { | 509 | { |
515 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | 510 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
@@ -526,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
526 | { | 521 | { |
527 | List<ScenePresence> presences = new List<ScenePresence>(); | 522 | List<ScenePresence> presences = new List<ScenePresence>(); |
528 | 523 | ||
529 | ForEachCurrentScene(delegate(Scene scene) | 524 | ForEachSelectedScene(delegate(Scene scene) |
530 | { | 525 | { |
531 | scene.ForEachScenePresence(delegate(ScenePresence sp) | 526 | scene.ForEachScenePresence(delegate(ScenePresence sp) |
532 | { | 527 | { |
@@ -555,12 +550,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
555 | 550 | ||
556 | public void ForceCurrentSceneClientUpdate() | 551 | public void ForceCurrentSceneClientUpdate() |
557 | { | 552 | { |
558 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 553 | ForEachSelectedScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
559 | } | 554 | } |
560 | 555 | ||
561 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 556 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
562 | { | 557 | { |
563 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 558 | ForEachSelectedScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
564 | } | 559 | } |
565 | 560 | ||
566 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) | 561 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 37ab35a..ef1b92e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | |||
@@ -551,13 +551,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | |||
551 | reqStream.Close(); | 551 | reqStream.Close(); |
552 | } | 552 | } |
553 | 553 | ||
554 | HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse(); | 554 | using (HttpWebResponse fwdrsp = (HttpWebResponse)forwardreq.GetResponse()) |
555 | Encoding encoding = Util.UTF8; | 555 | { |
556 | StreamReader fwdresponsestream = new StreamReader(fwdrsp.GetResponseStream(), encoding); | 556 | Encoding encoding = Util.UTF8; |
557 | fwdresponsestr = fwdresponsestream.ReadToEnd(); | 557 | |
558 | fwdresponsecontenttype = fwdrsp.ContentType; | 558 | using (Stream s = fwdrsp.GetResponseStream()) |
559 | fwdresponsecode = (int)fwdrsp.StatusCode; | 559 | { |
560 | fwdresponsestream.Close(); | 560 | using (StreamReader fwdresponsestream = new StreamReader(s)) |
561 | { | ||
562 | fwdresponsestr = fwdresponsestream.ReadToEnd(); | ||
563 | fwdresponsecontenttype = fwdrsp.ContentType; | ||
564 | fwdresponsecode = (int)fwdrsp.StatusCode; | ||
565 | } | ||
566 | } | ||
567 | } | ||
561 | 568 | ||
562 | response["content_type"] = fwdresponsecontenttype; | 569 | response["content_type"] = fwdresponsecontenttype; |
563 | response["str_response_string"] = fwdresponsestr; | 570 | response["str_response_string"] = fwdresponsestr; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 881807a..cb69411 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | |||
@@ -1116,18 +1116,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice | |||
1116 | // Otherwise prepare the request | 1116 | // Otherwise prepare the request |
1117 | m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); | 1117 | m_log.DebugFormat("[VivoxVoice] Sending request <{0}>", requrl); |
1118 | 1118 | ||
1119 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); | 1119 | HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requrl); |
1120 | HttpWebResponse rsp = null; | ||
1121 | 1120 | ||
1122 | // We are sending just parameters, no content | 1121 | // We are sending just parameters, no content |
1123 | req.ContentLength = 0; | 1122 | req.ContentLength = 0; |
1124 | 1123 | ||
1125 | // Send request and retrieve the response | 1124 | // Send request and retrieve the response |
1126 | rsp = (HttpWebResponse)req.GetResponse(); | 1125 | using (HttpWebResponse rsp = (HttpWebResponse)req.GetResponse()) |
1127 | 1126 | using (Stream s = rsp.GetResponseStream()) | |
1128 | XmlTextReader rdr = new XmlTextReader(rsp.GetResponseStream()); | 1127 | using (XmlTextReader rdr = new XmlTextReader(s)) |
1129 | doc.Load(rdr); | 1128 | doc.Load(rdr); |
1130 | rdr.Close(); | ||
1131 | } | 1129 | } |
1132 | catch (Exception e) | 1130 | catch (Exception e) |
1133 | { | 1131 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 1101851..71b24ac 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -1146,28 +1146,38 @@ namespace Nwc.XmlRpc | |||
1146 | request.AllowWriteStreamBuffering = true; | 1146 | request.AllowWriteStreamBuffering = true; |
1147 | request.KeepAlive = !_disableKeepAlive; | 1147 | request.KeepAlive = !_disableKeepAlive; |
1148 | 1148 | ||
1149 | Stream stream = request.GetRequestStream(); | 1149 | using (Stream stream = request.GetRequestStream()) |
1150 | XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); | ||
1151 | _serializer.Serialize(xml, this); | ||
1152 | xml.Flush(); | ||
1153 | xml.Close(); | ||
1154 | |||
1155 | HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | ||
1156 | StreamReader input = new StreamReader(response.GetResponseStream()); | ||
1157 | |||
1158 | string inputXml = input.ReadToEnd(); | ||
1159 | XmlRpcResponse resp; | ||
1160 | try | ||
1161 | { | 1150 | { |
1162 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | 1151 | using (XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII)) |
1152 | { | ||
1153 | _serializer.Serialize(xml, this); | ||
1154 | xml.Flush(); | ||
1155 | } | ||
1163 | } | 1156 | } |
1164 | catch (Exception e) | 1157 | |
1158 | XmlRpcResponse resp; | ||
1159 | |||
1160 | using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) | ||
1165 | { | 1161 | { |
1166 | RequestResponse = inputXml; | 1162 | using (Stream s = response.GetResponseStream()) |
1167 | throw e; | 1163 | { |
1164 | using (StreamReader input = new StreamReader(s)) | ||
1165 | { | ||
1166 | string inputXml = input.ReadToEnd(); | ||
1167 | |||
1168 | try | ||
1169 | { | ||
1170 | resp = (XmlRpcResponse)_deserializer.Deserialize(inputXml); | ||
1171 | } | ||
1172 | catch (Exception e) | ||
1173 | { | ||
1174 | RequestResponse = inputXml; | ||
1175 | throw e; | ||
1176 | } | ||
1177 | } | ||
1178 | } | ||
1168 | } | 1179 | } |
1169 | input.Close(); | 1180 | |
1170 | response.Close(); | ||
1171 | return resp; | 1181 | return resp; |
1172 | } | 1182 | } |
1173 | } | 1183 | } |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs index 7d37135..ad2fc7a 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs | |||
@@ -33,6 +33,11 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | // You will need to uncomment this line if you are adding a region module to some other assembly which does not already | ||
37 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | ||
38 | // the available DLLs | ||
39 | //[assembly: Addin("MyModule", "1.0")] | ||
40 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared | 41 | namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared |
37 | { | 42 | { |
38 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index 781fe95..bb9cbb7 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs | |||
@@ -33,6 +33,11 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | // You will need to uncomment this line if you are adding a region module to some other assembly which does not already | ||
37 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | ||
38 | // the available DLLs | ||
39 | //[assembly: Addin("MyModule", "1.0")] | ||
40 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared | 41 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared |
37 | { | 42 | { |
38 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 1f186c3..f442ca2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -204,7 +204,7 @@ public sealed class BSCharacter : BSPhysObject | |||
204 | // move. Thus, the velocity cannot be forced to zero. The problem is that small velocity | 204 | // move. Thus, the velocity cannot be forced to zero. The problem is that small velocity |
205 | // errors can creap in and the avatar will slowly float off in some direction. | 205 | // errors can creap in and the avatar will slowly float off in some direction. |
206 | // So, the problem is that, when an avatar is standing, we cannot tell creaping error | 206 | // So, the problem is that, when an avatar is standing, we cannot tell creaping error |
207 | // from real pushing.OMV.Vector3.Zero; | 207 | // from real pushing. |
208 | // The code below keeps setting the velocity to zero hoping the world will keep pushing. | 208 | // The code below keeps setting the velocity to zero hoping the world will keep pushing. |
209 | 209 | ||
210 | _velocityMotor.Step(timeStep); | 210 | _velocityMotor.Step(timeStep); |
@@ -254,9 +254,11 @@ public sealed class BSCharacter : BSPhysObject | |||
254 | } | 254 | } |
255 | 255 | ||
256 | // If falling, we keep the world's downward vector no matter what the other axis specify. | 256 | // If falling, we keep the world's downward vector no matter what the other axis specify. |
257 | // The check for _velocity.Z < 0 makes jumping work (temporary upward force). | ||
257 | if (!Flying && !IsColliding) | 258 | if (!Flying && !IsColliding) |
258 | { | 259 | { |
259 | stepVelocity.Z = _velocity.Z; | 260 | if (_velocity.Z < 0) |
261 | stepVelocity.Z = _velocity.Z; | ||
260 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); | 262 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); |
261 | } | 263 | } |
262 | 264 | ||
@@ -512,7 +514,7 @@ public sealed class BSCharacter : BSPhysObject | |||
512 | // just assign to "Position" because of potential call loops. | 514 | // just assign to "Position" because of potential call loops. |
513 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() | 515 | PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate() |
514 | { | 516 | { |
515 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 517 | DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
516 | ForcePosition = _position; | 518 | ForcePosition = _position; |
517 | }); | 519 | }); |
518 | ret = true; | 520 | ret = true; |
@@ -572,7 +574,7 @@ public sealed class BSCharacter : BSPhysObject | |||
572 | m_targetVelocity = value; | 574 | m_targetVelocity = value; |
573 | OMV.Vector3 targetVel = value; | 575 | OMV.Vector3 targetVel = value; |
574 | if (_setAlwaysRun) | 576 | if (_setAlwaysRun) |
575 | targetVel *= BSParam.AvatarAlwaysRunFactor; | 577 | targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f); |
576 | 578 | ||
577 | PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate() | 579 | PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate() |
578 | { | 580 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 4dff927..8f660c4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -470,7 +470,7 @@ public class BSPrim : BSPhysObject | |||
470 | // Note that this does not change _mass! | 470 | // Note that this does not change _mass! |
471 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) | 471 | public override void UpdatePhysicalMassProperties(float physMass, bool inWorld) |
472 | { | 472 | { |
473 | if (PhysBody.HasPhysicalBody) | 473 | if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) |
474 | { | 474 | { |
475 | if (IsStatic) | 475 | if (IsStatic) |
476 | { | 476 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 49718c4..4dc16f4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -1,5 +1,12 @@ | |||
1 | CURRENT PRIORITIES | 1 | CURRENT PRIORITIES |
2 | ================================================= | 2 | ================================================= |
3 | Use the HACD convex hull routine in Bullet rather than the C# version. | ||
4 | Speed up hullifying large meshes. | ||
5 | Enable vehicle border crossings (at least as poorly as ODE) | ||
6 | Terrain skirts | ||
7 | Avatar created in previous region and not new region when crossing border | ||
8 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
9 | Lock axis | ||
3 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. | 10 | Deleting a linkset while standing on the root will leave the physical shape of the root behind. |
4 | Not sure if it is because standing on it. Done with large prim linksets. | 11 | Not sure if it is because standing on it. Done with large prim linksets. |
5 | Vehicle angular vertical attraction | 12 | Vehicle angular vertical attraction |
@@ -7,16 +14,11 @@ vehicle angular banking | |||
7 | Center-of-gravity | 14 | Center-of-gravity |
8 | Vehicle angular deflection | 15 | Vehicle angular deflection |
9 | Preferred orientation angular correction fix | 16 | Preferred orientation angular correction fix |
10 | Enable vehicle border crossings (at least as poorly as ODE) | ||
11 | Terrain skirts | ||
12 | Avatar created in previous region and not new region when crossing border | ||
13 | Vehicle recreated in new sim at small Z value (offset from root value?) (DONE) | ||
14 | when should angular and linear motor targets be zeroed? when selected? | 17 | when should angular and linear motor targets be zeroed? when selected? |
15 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. | 18 | Need a vehicle.clear()? Or an 'else' in prestep if not physical. |
16 | Teravus llMoveToTarget script debug | 19 | Teravus llMoveToTarget script debug |
17 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force | 20 | Mixing of hover, buoyancy/gravity, moveToTarget, into one force |
18 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) | 21 | Setting hover height to zero disables hover even if hover flags are on (from SL wiki) |
19 | Nebadon vehicles turning funny in arena | ||
20 | limitMotorUp calibration (more down?) | 22 | limitMotorUp calibration (more down?) |
21 | llRotLookAt | 23 | llRotLookAt |
22 | llLookAt | 24 | llLookAt |
@@ -66,6 +68,8 @@ Vehicle attributes are not restored when a vehicle is rezzed on region creation | |||
66 | 68 | ||
67 | GENERAL TODO LIST: | 69 | GENERAL TODO LIST: |
68 | ================================================= | 70 | ================================================= |
71 | Resitution of a prim works on another prim but not on terrain. | ||
72 | The dropped prim doesn't bounce properly on the terrain. | ||
69 | Add a sanity check for PIDTarget location. | 73 | Add a sanity check for PIDTarget location. |
70 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. | 74 | Level-of-detail for mesh creation. Prims with circular interiors require lod of 32. |
71 | Is much saved with lower LODs? At the moment, all set to 32. | 75 | Is much saved with lower LODs? At the moment, all set to 32. |
@@ -163,7 +167,6 @@ Create tests for different interface components | |||
163 | Have test objects/scripts measure themselves and turn color if correct/bad | 167 | Have test objects/scripts measure themselves and turn color if correct/bad |
164 | Test functions in SL and calibrate correctness there | 168 | Test functions in SL and calibrate correctness there |
165 | Create auto rezzer and tracker to run through the tests | 169 | Create auto rezzer and tracker to run through the tests |
166 | Use the HACD convex hull routine in Bullet rather than the C# version. | ||
167 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? | 170 | Do we need to do convex hulls all the time? Can complex meshes be left meshes? |
168 | There is some problem with meshes and collisions | 171 | There is some problem with meshes and collisions |
169 | Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. | 172 | Hulls are not as detailed as meshes. Hulled vehicles insides are different shape. |
@@ -334,4 +337,5 @@ Child movement in linkset (don't rebuild linkset) (DONE 20130122)) | |||
334 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) | 337 | Avatar standing on a moving object should start to move with the object. (DONE 20130125) |
335 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. | 338 | Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. |
336 | Verify that angular motion specified around Z moves in the vehicle coordinates. | 339 | Verify that angular motion specified around Z moves in the vehicle coordinates. |
337 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. \ No newline at end of file | 340 | DONE 20130120: BulletSim properly applies force in vehicle relative coordinates. |
341 | Nebadon vehicles turning funny in arena (DONE) \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 96f650e..6a31568 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -9423,6 +9423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9423 | return UUID.Zero.ToString(); | 9423 | return UUID.Zero.ToString(); |
9424 | } | 9424 | } |
9425 | } | 9425 | } |
9426 | |||
9426 | public LSL_String llRequestURL() | 9427 | public LSL_String llRequestURL() |
9427 | { | 9428 | { |
9428 | m_host.AddScriptLPS(1); | 9429 | m_host.AddScriptLPS(1); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs index 7ea30bf1..ac822c6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/Tests/CoopTerminationTests.cs | |||
@@ -443,7 +443,6 @@ default | |||
443 | string itemName = "TestNoStop"; | 443 | string itemName = "TestNoStop"; |
444 | 444 | ||
445 | SceneObjectPart partWhereRezzed = CreateScript(script, itemName, userId); | 445 | SceneObjectPart partWhereRezzed = CreateScript(script, itemName, userId); |
446 | TaskInventoryItem rezzedItem = partWhereRezzed.Inventory.GetInventoryItem(itemName); | ||
447 | 446 | ||
448 | // Wait for the script to start the event before we try stopping it. | 447 | // Wait for the script to start the event before we try stopping it. |
449 | m_chatEvent.WaitOne(60000); | 448 | m_chatEvent.WaitOne(60000); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs new file mode 100644 index 0000000..b0baa1c --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using NUnit.Framework; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Servers; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Region.CoreModules.Scripting.LSLHttp; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Region.ScriptEngine.Shared; | ||
44 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
45 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
46 | using OpenSim.Services.Interfaces; | ||
47 | using OpenSim.Tests.Common; | ||
48 | using OpenSim.Tests.Common.Mock; | ||
49 | |||
50 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | ||
51 | { | ||
52 | /// <summary> | ||
53 | /// Tests for HTTP related functions in LSL | ||
54 | /// </summary> | ||
55 | [TestFixture] | ||
56 | public class LSL_ApiHttpTests : OpenSimTestCase | ||
57 | { | ||
58 | private Scene m_scene; | ||
59 | private MockScriptEngine m_engine; | ||
60 | private UrlModule m_urlModule; | ||
61 | |||
62 | private TaskInventoryItem m_scriptItem; | ||
63 | private LSL_Api m_lslApi; | ||
64 | |||
65 | [TestFixtureSetUp] | ||
66 | public void TestFixtureSetUp() | ||
67 | { | ||
68 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
69 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
70 | } | ||
71 | |||
72 | [TestFixtureTearDown] | ||
73 | public void TestFixureTearDown() | ||
74 | { | ||
75 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
76 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
77 | // tests really shouldn't). | ||
78 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
79 | } | ||
80 | |||
81 | [SetUp] | ||
82 | public override void SetUp() | ||
83 | { | ||
84 | base.SetUp(); | ||
85 | |||
86 | // This is an unfortunate bit of clean up we have to do because MainServer manages things through static | ||
87 | // variables and the VM is not restarted between tests. | ||
88 | uint port = 9999; | ||
89 | MainServer.RemoveHttpServer(port); | ||
90 | |||
91 | BaseHttpServer server = new BaseHttpServer(port, false, 0, ""); | ||
92 | MainServer.AddHttpServer(server); | ||
93 | MainServer.Instance = server; | ||
94 | |||
95 | server.Start(); | ||
96 | |||
97 | m_engine = new MockScriptEngine(); | ||
98 | m_urlModule = new UrlModule(); | ||
99 | |||
100 | m_scene = new SceneHelpers().SetupScene(); | ||
101 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule); | ||
102 | |||
103 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
104 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, so.RootPart); | ||
105 | |||
106 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. | ||
107 | // Possibly this could be done and we could obtain it directly from the MockScriptEngine. | ||
108 | m_lslApi = new LSL_Api(); | ||
109 | m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null); | ||
110 | } | ||
111 | |||
112 | [TearDown] | ||
113 | public void TearDown() | ||
114 | { | ||
115 | MainServer.Instance.Stop(); | ||
116 | } | ||
117 | |||
118 | [Test] | ||
119 | public void TestLlReleaseUrl() | ||
120 | { | ||
121 | TestHelpers.InMethod(); | ||
122 | |||
123 | m_lslApi.llRequestURL(); | ||
124 | string returnedUri = m_engine.PostedEvents[m_scriptItem.ItemID][0].Params[2].ToString(); | ||
125 | |||
126 | { | ||
127 | // Check that the initial number of URLs is correct | ||
128 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
129 | } | ||
130 | |||
131 | { | ||
132 | // Check releasing a non-url | ||
133 | m_lslApi.llReleaseURL("GARBAGE"); | ||
134 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
135 | } | ||
136 | |||
137 | { | ||
138 | // Check releasing a non-existing url | ||
139 | m_lslApi.llReleaseURL("http://example.com"); | ||
140 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
141 | } | ||
142 | |||
143 | { | ||
144 | // Check URL release | ||
145 | m_lslApi.llReleaseURL(returnedUri); | ||
146 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls)); | ||
147 | |||
148 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri); | ||
149 | |||
150 | bool gotExpectedException = false; | ||
151 | |||
152 | try | ||
153 | { | ||
154 | using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) | ||
155 | {} | ||
156 | } | ||
157 | catch (WebException e) | ||
158 | { | ||
159 | using (HttpWebResponse response = (HttpWebResponse)e.Response) | ||
160 | gotExpectedException = response.StatusCode == HttpStatusCode.NotFound; | ||
161 | } | ||
162 | |||
163 | Assert.That(gotExpectedException, Is.True); | ||
164 | } | ||
165 | |||
166 | { | ||
167 | // Check releasing the same URL again | ||
168 | m_lslApi.llReleaseURL(returnedUri); | ||
169 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls)); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | [Test] | ||
174 | public void TestLlRequestUrl() | ||
175 | { | ||
176 | TestHelpers.InMethod(); | ||
177 | |||
178 | string requestId = m_lslApi.llRequestURL(); | ||
179 | Assert.That(requestId, Is.Not.EqualTo(UUID.Zero.ToString())); | ||
180 | string returnedUri; | ||
181 | |||
182 | { | ||
183 | // Check that URL is correctly set up | ||
184 | Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
185 | |||
186 | Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
187 | |||
188 | List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
189 | Assert.That(events.Count, Is.EqualTo(1)); | ||
190 | EventParams eventParams = events[0]; | ||
191 | Assert.That(eventParams.EventName, Is.EqualTo("http_request")); | ||
192 | |||
193 | UUID returnKey; | ||
194 | string rawReturnKey = eventParams.Params[0].ToString(); | ||
195 | string method = eventParams.Params[1].ToString(); | ||
196 | returnedUri = eventParams.Params[2].ToString(); | ||
197 | |||
198 | Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); | ||
199 | Assert.That(method, Is.EqualTo(ScriptBaseClass.URL_REQUEST_GRANTED)); | ||
200 | Assert.That(Uri.IsWellFormedUriString(returnedUri, UriKind.Absolute), Is.True); | ||
201 | } | ||
202 | |||
203 | { | ||
204 | // Check that request to URL works. | ||
205 | string testResponse = "Hello World"; | ||
206 | |||
207 | m_engine.ClearPostedEvents(); | ||
208 | m_engine.PostEventHook | ||
209 | += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse); | ||
210 | |||
211 | // Console.WriteLine("Trying {0}", returnedUri); | ||
212 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri); | ||
213 | |||
214 | AssertHttpResponse(returnedUri, testResponse); | ||
215 | |||
216 | Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
217 | |||
218 | List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
219 | Assert.That(events.Count, Is.EqualTo(1)); | ||
220 | EventParams eventParams = events[0]; | ||
221 | Assert.That(eventParams.EventName, Is.EqualTo("http_request")); | ||
222 | |||
223 | UUID returnKey; | ||
224 | string rawReturnKey = eventParams.Params[0].ToString(); | ||
225 | string method = eventParams.Params[1].ToString(); | ||
226 | string body = eventParams.Params[2].ToString(); | ||
227 | |||
228 | Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); | ||
229 | Assert.That(method, Is.EqualTo("GET")); | ||
230 | Assert.That(body, Is.EqualTo("")); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | private void AssertHttpResponse(string uri, string expectedResponse) | ||
235 | { | ||
236 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri); | ||
237 | |||
238 | using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) | ||
239 | { | ||
240 | using (Stream stream = webResponse.GetResponseStream()) | ||
241 | { | ||
242 | using (StreamReader reader = new StreamReader(stream)) | ||
243 | { | ||
244 | Assert.That(reader.ReadToEnd(), Is.EqualTo(expectedResponse)); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 1f8a6e5..74f010e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | |||
@@ -222,7 +222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
222 | // Store an avatar with a different height from default in a notecard. | 222 | // Store an avatar with a different height from default in a notecard. |
223 | UUID userId = TestHelpers.ParseTail(0x1); | 223 | UUID userId = TestHelpers.ParseTail(0x1); |
224 | float firstHeight = 1.9f; | 224 | float firstHeight = 1.9f; |
225 | float secondHeight = 2.1f; | 225 | // float secondHeight = 2.1f; |
226 | string firstAppearanceNcName = "appearanceNc1"; | 226 | string firstAppearanceNcName = "appearanceNc1"; |
227 | string secondAppearanceNcName = "appearanceNc2"; | 227 | string secondAppearanceNcName = "appearanceNc2"; |
228 | 228 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5c50936..5004d99 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs | |||
@@ -73,7 +73,6 @@ namespace OpenSim.Services.Connectors | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | |||
77 | public virtual string Helo() | 76 | public virtual string Helo() |
78 | { | 77 | { |
79 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | 78 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); |
@@ -82,10 +81,12 @@ namespace OpenSim.Services.Connectors | |||
82 | 81 | ||
83 | try | 82 | try |
84 | { | 83 | { |
85 | WebResponse response = req.GetResponse(); | 84 | using (WebResponse response = req.GetResponse()) |
86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null | 85 | { |
87 | return string.Empty; | 86 | if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null |
88 | return response.Headers.Get("X-Handlers-Provided"); | 87 | return string.Empty; |
88 | return response.Headers.Get("X-Handlers-Provided"); | ||
89 | } | ||
89 | } | 90 | } |
90 | catch (Exception e) | 91 | catch (Exception e) |
91 | { | 92 | { |
@@ -95,6 +96,5 @@ namespace OpenSim.Services.Connectors | |||
95 | // fail | 96 | // fail |
96 | return string.Empty; | 97 | return string.Empty; |
97 | } | 98 | } |
98 | |||
99 | } | 99 | } |
100 | } | 100 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 2f263ae..47d0cce 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -171,41 +171,45 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
171 | // Let's wait for the response | 171 | // Let's wait for the response |
172 | //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); | 172 | //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall"); |
173 | 173 | ||
174 | WebResponse webResponse = null; | ||
175 | StreamReader sr = null; | ||
176 | try | 174 | try |
177 | { | 175 | { |
178 | webResponse = AgentCreateRequest.GetResponse(); | 176 | using (WebResponse webResponse = AgentCreateRequest.GetResponse()) |
179 | if (webResponse == null) | ||
180 | { | 177 | { |
181 | m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); | 178 | if (webResponse == null) |
182 | } | ||
183 | else | ||
184 | { | ||
185 | |||
186 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
187 | string response = sr.ReadToEnd().Trim(); | ||
188 | m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); | ||
189 | |||
190 | if (!String.IsNullOrEmpty(response)) | ||
191 | { | 179 | { |
192 | try | 180 | m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post"); |
193 | { | 181 | } |
194 | // we assume we got an OSDMap back | 182 | else |
195 | OSDMap r = Util.GetOSDMap(response); | 183 | { |
196 | bool success = r["success"].AsBoolean(); | 184 | using (Stream s = webResponse.GetResponseStream()) |
197 | reason = r["reason"].AsString(); | ||
198 | return success; | ||
199 | } | ||
200 | catch (NullReferenceException e) | ||
201 | { | 185 | { |
202 | m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); | 186 | using (StreamReader sr = new StreamReader(s)) |
203 | 187 | { | |
204 | // check for old style response | 188 | string response = sr.ReadToEnd().Trim(); |
205 | if (response.ToLower().StartsWith("true")) | 189 | m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); |
206 | return true; | 190 | |
207 | 191 | if (!String.IsNullOrEmpty(response)) | |
208 | return false; | 192 | { |
193 | try | ||
194 | { | ||
195 | // we assume we got an OSDMap back | ||
196 | OSDMap r = Util.GetOSDMap(response); | ||
197 | bool success = r["success"].AsBoolean(); | ||
198 | reason = r["reason"].AsString(); | ||
199 | return success; | ||
200 | } | ||
201 | catch (NullReferenceException e) | ||
202 | { | ||
203 | m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); | ||
204 | |||
205 | // check for old style response | ||
206 | if (response.ToLower().StartsWith("true")) | ||
207 | return true; | ||
208 | |||
209 | return false; | ||
210 | } | ||
211 | } | ||
212 | } | ||
209 | } | 213 | } |
210 | } | 214 | } |
211 | } | 215 | } |
@@ -216,11 +220,6 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
216 | reason = "Destination did not reply"; | 220 | reason = "Destination did not reply"; |
217 | return false; | 221 | return false; |
218 | } | 222 | } |
219 | finally | ||
220 | { | ||
221 | if (sr != null) | ||
222 | sr.Close(); | ||
223 | } | ||
224 | 223 | ||
225 | return true; | 224 | return true; |
226 | 225 | ||
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 7429293..5948380 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -168,22 +168,27 @@ namespace OpenSim.Services.Connectors | |||
168 | // Let's wait for the response | 168 | // Let's wait for the response |
169 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | 169 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); |
170 | 170 | ||
171 | StreamReader sr = null; | ||
172 | try | 171 | try |
173 | { | 172 | { |
174 | WebResponse webResponse = helloNeighbourRequest.GetResponse(); | 173 | using (WebResponse webResponse = helloNeighbourRequest.GetResponse()) |
175 | if (webResponse == null) | ||
176 | { | 174 | { |
177 | m_log.DebugFormat( | 175 | if (webResponse == null) |
178 | "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", | 176 | { |
179 | thisRegion.RegionName, region.RegionName); | 177 | m_log.DebugFormat( |
178 | "[REST COMMS]: Null reply on DoHelloNeighbourCall post from {0} to {1}", | ||
179 | thisRegion.RegionName, region.RegionName); | ||
180 | } | ||
181 | |||
182 | using (Stream s = webResponse.GetResponseStream()) | ||
183 | { | ||
184 | using (StreamReader sr = new StreamReader(s)) | ||
185 | { | ||
186 | //reply = sr.ReadToEnd().Trim(); | ||
187 | sr.ReadToEnd().Trim(); | ||
188 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
189 | } | ||
190 | } | ||
180 | } | 191 | } |
181 | |||
182 | sr = new StreamReader(webResponse.GetResponseStream()); | ||
183 | //reply = sr.ReadToEnd().Trim(); | ||
184 | sr.ReadToEnd().Trim(); | ||
185 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
186 | |||
187 | } | 192 | } |
188 | catch (Exception e) | 193 | catch (Exception e) |
189 | { | 194 | { |
@@ -193,11 +198,6 @@ namespace OpenSim.Services.Connectors | |||
193 | 198 | ||
194 | return false; | 199 | return false; |
195 | } | 200 | } |
196 | finally | ||
197 | { | ||
198 | if (sr != null) | ||
199 | sr.Close(); | ||
200 | } | ||
201 | 201 | ||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 63a32e7..74b980c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -339,36 +339,38 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
339 | // Simian does not require the asset ID to be in the URL because it's in the post data. | 339 | // Simian does not require the asset ID to be in the URL because it's in the post data. |
340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs | 340 | // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs |
341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); | 341 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); |
342 | |||
343 | HttpWebResponse response = MultipartForm.Post(request, postParameters); | ||
344 | using (Stream responseStream = response.GetResponseStream()) | ||
345 | { | ||
346 | string responseStr = null; | ||
347 | 342 | ||
348 | try | 343 | using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) |
344 | { | ||
345 | using (Stream responseStream = response.GetResponseStream()) | ||
349 | { | 346 | { |
350 | responseStr = responseStream.GetStreamString(); | 347 | string responseStr = null; |
351 | OSD responseOSD = OSDParser.Deserialize(responseStr); | 348 | |
352 | if (responseOSD.Type == OSDType.Map) | 349 | try |
353 | { | 350 | { |
354 | OSDMap responseMap = (OSDMap)responseOSD; | 351 | responseStr = responseStream.GetStreamString(); |
355 | if (responseMap["Success"].AsBoolean()) | 352 | OSD responseOSD = OSDParser.Deserialize(responseStr); |
356 | return asset.ID; | 353 | if (responseOSD.Type == OSDType.Map) |
354 | { | ||
355 | OSDMap responseMap = (OSDMap)responseOSD; | ||
356 | if (responseMap["Success"].AsBoolean()) | ||
357 | return asset.ID; | ||
358 | else | ||
359 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
360 | } | ||
357 | else | 361 | else |
358 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | 362 | { |
363 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
364 | } | ||
359 | } | 365 | } |
360 | else | 366 | catch (Exception ex) |
361 | { | 367 | { |
362 | errorMessage = "Response format was invalid:\n" + responseStr; | 368 | if (!String.IsNullOrEmpty(responseStr)) |
369 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
370 | else | ||
371 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
363 | } | 372 | } |
364 | } | 373 | } |
365 | catch (Exception ex) | ||
366 | { | ||
367 | if (!String.IsNullOrEmpty(responseStr)) | ||
368 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
369 | else | ||
370 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
371 | } | ||
372 | } | 374 | } |
373 | } | 375 | } |
374 | catch (WebException ex) | 376 | catch (WebException ex) |
@@ -378,6 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
378 | 380 | ||
379 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", | 381 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}", |
380 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); | 382 | asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage); |
383 | |||
381 | return null; | 384 | return null; |
382 | } | 385 | } |
383 | 386 | ||
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index 78bab5b..6a53fe7 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -40,10 +40,33 @@ namespace OpenSim.Tests.Common | |||
40 | { | 40 | { |
41 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine | 41 | public class MockScriptEngine : INonSharedRegionModule, IScriptModule, IScriptEngine |
42 | { | 42 | { |
43 | public IConfigSource ConfigSource { get; private set; } | ||
44 | |||
45 | public IConfig Config { get; private set; } | ||
46 | |||
43 | private Scene m_scene; | 47 | private Scene m_scene; |
44 | 48 | ||
49 | /// <summary> | ||
50 | /// Expose posted events to tests. | ||
51 | /// </summary> | ||
52 | public Dictionary<UUID, List<EventParams>> PostedEvents { get; private set; } | ||
53 | |||
54 | /// <summary> | ||
55 | /// A very primitive way of hooking text cose to a posed event. | ||
56 | /// </summary> | ||
57 | /// <remarks> | ||
58 | /// May be replaced with something that uses more original code in the future. | ||
59 | /// </remarks> | ||
60 | public event Action<UUID, EventParams> PostEventHook; | ||
61 | |||
45 | public void Initialise(IConfigSource source) | 62 | public void Initialise(IConfigSource source) |
46 | { | 63 | { |
64 | ConfigSource = source; | ||
65 | |||
66 | // Can set later on if required | ||
67 | Config = new IniConfig("MockScriptEngine", ConfigSource); | ||
68 | |||
69 | PostedEvents = new Dictionary<UUID, List<EventParams>>(); | ||
47 | } | 70 | } |
48 | 71 | ||
49 | public void Close() | 72 | public void Close() |
@@ -85,7 +108,28 @@ namespace OpenSim.Tests.Common | |||
85 | 108 | ||
86 | public bool PostScriptEvent(UUID itemID, string name, object[] args) | 109 | public bool PostScriptEvent(UUID itemID, string name, object[] args) |
87 | { | 110 | { |
88 | return false; | 111 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); |
112 | |||
113 | EventParams evParams = new EventParams(name, args, null); | ||
114 | |||
115 | List<EventParams> eventsForItem; | ||
116 | |||
117 | if (!PostedEvents.ContainsKey(itemID)) | ||
118 | { | ||
119 | eventsForItem = new List<EventParams>(); | ||
120 | PostedEvents.Add(itemID, eventsForItem); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | eventsForItem = PostedEvents[itemID]; | ||
125 | } | ||
126 | |||
127 | eventsForItem.Add(evParams); | ||
128 | |||
129 | if (PostEventHook != null) | ||
130 | PostEventHook(itemID, evParams); | ||
131 | |||
132 | return true; | ||
89 | } | 133 | } |
90 | 134 | ||
91 | public bool PostObjectEvent(UUID itemID, string name, object[] args) | 135 | public bool PostObjectEvent(UUID itemID, string name, object[] args) |
@@ -195,11 +239,7 @@ namespace OpenSim.Tests.Common | |||
195 | 239 | ||
196 | public Scene World { get { return m_scene; } } | 240 | public Scene World { get { return m_scene; } } |
197 | 241 | ||
198 | public IScriptModule ScriptModule { get { throw new System.NotImplementedException(); } } | 242 | public IScriptModule ScriptModule { get { return this; } } |
199 | |||
200 | public IConfig Config { get { throw new System.NotImplementedException (); } } | ||
201 | |||
202 | public IConfigSource ConfigSource { get { throw new System.NotImplementedException (); } } | ||
203 | 243 | ||
204 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} | 244 | public string ScriptEnginePath { get { throw new System.NotImplementedException (); }} |
205 | 245 | ||
@@ -210,5 +250,10 @@ namespace OpenSim.Tests.Common | |||
210 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } | 250 | public string[] ScriptReferencedAssemblies { get { throw new System.NotImplementedException (); } } |
211 | 251 | ||
212 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } | 252 | public ParameterInfo[] ScriptBaseClassParameters { get { throw new System.NotImplementedException (); } } |
253 | |||
254 | public void ClearPostedEvents() | ||
255 | { | ||
256 | PostedEvents.Clear(); | ||
257 | } | ||
213 | } | 258 | } |
214 | } \ No newline at end of file | 259 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs index e5186ae..9d63324 100644 --- a/OpenSim/Tests/ConfigurationLoaderTest.cs +++ b/OpenSim/Tests/ConfigurationLoaderTest.cs | |||
@@ -47,6 +47,8 @@ namespace OpenSim.Tests | |||
47 | [SetUp] | 47 | [SetUp] |
48 | public void SetUp() | 48 | public void SetUp() |
49 | { | 49 | { |
50 | base.SetUp(); | ||
51 | |||
50 | m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); | 52 | m_basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); |
51 | string path = Path.Combine(m_basePath, m_testSubdirectory); | 53 | string path = Path.Combine(m_basePath, m_testSubdirectory); |
52 | Directory.CreateDirectory(path); | 54 | Directory.CreateDirectory(path); |