Skip to content

Commit

Permalink
2004-12-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>
Browse files Browse the repository at this point in the history
	* WebConnection.cs: set the event in Close so that if the queue is
	empty, we won't block forever on next request.


svn path=/branches/mono-1-0/mcs/; revision=37156
  • Loading branch information
gonzalop committed Dec 5, 2004
1 parent 28509a9 commit f5f748e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
3 changes: 2 additions & 1 deletion mcs/class/System/System.Net/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2004-12-05 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* WebConnection.cs: readd prevStream. Caused regressions.
* WebConnection.cs: set the event in Close so that if the queue is
empty, we won't block forever on next request.

2004-12-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>

Expand Down
19 changes: 2 additions & 17 deletions mcs/class/System/System.Net/WebConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class WebConnection
EventHandler abortHandler;
ReadState readState;
internal WebConnectionData Data;
WebConnectionStream prevStream;
bool chunkedRead;
ChunkStream chunkStream;
AutoResetEvent goAhead;
Expand Down Expand Up @@ -379,7 +378,6 @@ static void ReadDone (IAsyncResult result)
if (cnc.queue.Count > 0) {
stream.ReadAll ();
} else {
cnc.prevStream = stream;
stream.CheckComplete ();
}
}
Expand Down Expand Up @@ -553,11 +551,6 @@ void InitConnection (object state, bool notUsed)
internal EventHandler SendRequest (HttpWebRequest request)
{
lock (this) {
if (prevStream != null && socket != null && socket.Connected) {
prevStream.ReadAll ();
prevStream = null;
}

if (!busy) {
busy = true;
ThreadPool.RegisterWaitForSingleObject (goAhead, initConn,
Expand All @@ -576,7 +569,6 @@ void SendNext ()
{
lock (queue) {
if (queue.Count > 0) {
prevStream = null;
SendRequest ((HttpWebRequest) queue.Dequeue ());
}
}
Expand All @@ -602,7 +594,6 @@ internal void NextRead ()
goAhead.Set ();
lock (queue) {
if (queue.Count > 0) {
prevStream = null;
SendRequest ((HttpWebRequest) queue.Dequeue ());
}
}
Expand Down Expand Up @@ -866,10 +857,9 @@ void Close (bool sendNext)
socket = null;
}

if (sendNext) {
goAhead.Set ();
goAhead.Set ();
if (sendNext)
SendNext ();
}
}
}

Expand All @@ -889,11 +879,6 @@ internal bool Connected {
}
}
}

~WebConnection ()
{
Close (false);
}
}
}

0 comments on commit f5f748e

Please sign in to comment.