diff options
author | Diva Canto | 2009-10-03 08:57:30 -0700 |
---|---|---|
committer | Diva Canto | 2009-10-03 08:57:30 -0700 |
commit | df7049008acd394fa514db584f56d0e3925a2d77 (patch) | |
tree | 2e0cabca6df29497ad266daf8a7caa493e0c75a4 /OpenSim | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-df7049008acd394fa514db584f56d0e3925a2d77.zip opensim-SC_OLD-df7049008acd394fa514db584f56d0e3925a2d77.tar.gz opensim-SC_OLD-df7049008acd394fa514db584f56d0e3925a2d77.tar.bz2 opensim-SC_OLD-df7049008acd394fa514db584f56d0e3925a2d77.tar.xz |
More streams closed.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 3f72c31..6c0aa46 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -88,6 +88,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
88 | serializer.Serialize(writer, sobj); | 88 | serializer.Serialize(writer, sobj); |
89 | writer.Flush(); | 89 | writer.Flush(); |
90 | } | 90 | } |
91 | buffer.Close(); | ||
91 | 92 | ||
92 | int length = (int)buffer.Length; | 93 | int length = (int)buffer.Length; |
93 | request.ContentLength = length; | 94 | request.ContentLength = length; |
@@ -99,8 +100,19 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
99 | using (WebResponse resp = request.GetResponse()) | 100 | using (WebResponse resp = request.GetResponse()) |
100 | { | 101 | { |
101 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 102 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
102 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); | 103 | Stream respStream = null; |
103 | resp.Close(); | 104 | try |
105 | { | ||
106 | respStream = resp.GetResponseStream(); | ||
107 | deserial = (TResponse)deserializer.Deserialize(respStream); | ||
108 | } | ||
109 | catch { } | ||
110 | finally | ||
111 | { | ||
112 | if (respStream != null) | ||
113 | respStream.Close(); | ||
114 | resp.Close(); | ||
115 | } | ||
104 | } | 116 | } |
105 | return deserial; | 117 | return deserial; |
106 | } | 118 | } |
@@ -140,6 +152,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
140 | serializer.Serialize(writer, sobj); | 152 | serializer.Serialize(writer, sobj); |
141 | writer.Flush(); | 153 | writer.Flush(); |
142 | } | 154 | } |
155 | buffer.Close(); | ||
143 | 156 | ||
144 | int length = (int)buffer.Length; | 157 | int length = (int)buffer.Length; |
145 | request.ContentLength = length; | 158 | request.ContentLength = length; |
@@ -165,6 +178,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
165 | // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); | 178 | // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); |
166 | 179 | ||
167 | deserial = (TResponse)deserializer.Deserialize(stream); | 180 | deserial = (TResponse)deserializer.Deserialize(stream); |
181 | if (stream != null) | ||
182 | stream.Close(); | ||
168 | 183 | ||
169 | if (deserial != null && ResponseCallback != null) | 184 | if (deserial != null && ResponseCallback != null) |
170 | { | 185 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs index 85622a1..e76d80e 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -62,6 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
62 | writer.Write(obj); | 62 | writer.Write(obj); |
63 | writer.Flush(); | 63 | writer.Flush(); |
64 | } | 64 | } |
65 | buffer.Close(); | ||
65 | 66 | ||
66 | length = (int)obj.Length; | 67 | length = (int)obj.Length; |
67 | request.ContentLength = length; | 68 | request.ContentLength = length; |