diff options
author | Oren Hurvitz | 2014-06-01 17:39:11 +0300 |
---|---|---|
committer | Justin Clark-Casey | 2014-08-02 00:55:57 +0100 |
commit | e41e52e09727842d990a31e2a5f7f3e9c88fe8b3 (patch) | |
tree | 5779c9f42cd913f63e2d237b5a407214933585db /OpenSim/Services | |
parent | Add code to GridService to check for overlapping of varregions (diff) | |
download | opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.zip opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.tar.gz opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.tar.bz2 opensim-SC_OLD-e41e52e09727842d990a31e2a5f7f3e9c88fe8b3.tar.xz |
Close streams immediately when we finish using them
Diffstat (limited to 'OpenSim/Services')
-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) |