diff options
author | Oren Hurvitz | 2014-06-01 17:39:11 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-07-21 08:30:03 +0100 |
commit | 99ac770abbe3a95887c4b10c82f3985aa878eeef (patch) | |
tree | 8c946dab083dd50a352f3861415eca43185d8d95 /OpenSim/Services/Connectors/Asset | |
parent | Set "[Terrain]SendTerrainUpdatesByViewDistance=true" by default. (diff) | |
download | opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.zip opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.gz opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.bz2 opensim-SC-99ac770abbe3a95887c4b10c82f3985aa878eeef.tar.xz |
Close streams immediately when we finish using them
Diffstat (limited to 'OpenSim/Services/Connectors/Asset')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 0996acb..badacb7 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -171,27 +171,29 @@ namespace OpenSim.Services.Connectors | |||
171 | return fullAsset.Data; | 171 | return fullAsset.Data; |
172 | } | 172 | } |
173 | 173 | ||
174 | RestClient rc = new RestClient(m_ServerURI); | 174 | using (RestClient rc = new RestClient(m_ServerURI)) |
175 | rc.AddResourcePath("assets"); | 175 | { |
176 | rc.AddResourcePath(id); | 176 | rc.AddResourcePath("assets"); |
177 | rc.AddResourcePath("data"); | 177 | rc.AddResourcePath(id); |
178 | rc.AddResourcePath("data"); | ||
178 | 179 | ||
179 | rc.RequestMethod = "GET"; | 180 | rc.RequestMethod = "GET"; |
180 | 181 | ||
181 | Stream s = rc.Request(m_Auth); | 182 | Stream s = rc.Request(m_Auth); |
182 | 183 | ||
183 | if (s == null) | 184 | if (s == null) |
184 | return null; | 185 | return null; |
185 | 186 | ||
186 | if (s.Length > 0) | 187 | if (s.Length > 0) |
187 | { | 188 | { |
188 | byte[] ret = new byte[s.Length]; | 189 | byte[] ret = new byte[s.Length]; |
189 | s.Read(ret, 0, (int)s.Length); | 190 | s.Read(ret, 0, (int)s.Length); |
190 | 191 | ||
191 | return ret; | 192 | return ret; |
192 | } | 193 | } |
193 | 194 | ||
194 | return null; | 195 | return null; |
196 | } | ||
195 | } | 197 | } |
196 | 198 | ||
197 | public bool Get(string id, Object sender, AssetRetrieved handler) | 199 | public bool Get(string id, Object sender, AssetRetrieved handler) |