Remove the "ConnectionState" from the connection list before closing the connection,
this should avoid ServicePoint.SendRequest() ever crashing with a NullReferenceException
due to getting a null return value from WebConnectionGroup.GetConnection().
* ServicePoint now uses an idle timer to close idle connections.
* WebConnectionGroup has been mostly rewritten to use a linked
list of open connections and their idle times.
This fixes both the problem that we were leaking sockets and
that we were not reusing existing connections.
* ServicePoint now correctly keeps track of the number of open
connections.
* ServicePointManager now uses the correct default idle time
of 100 seconds (previously 15 minutes).
* WebConnection uses the new WebConnectionGroup's busy logic
to correctly flag connections as busy / reusable.
* WebConnection.cs: remove prevStream and don't set busy to false in
HandleError. prevStream is not needed any more and setting 'busy' so
early might let a request skip the queue.
* WebConnectionGroup.cs: decrement the indexer when removing a dead
reference from the arraylist.
* WebConnectionStream.cs:
(ReadAll): call NextRead if it has not been called before even when
we have completed the request. Reuse the read buffer when reading a
response of unknown size. Increase the buffer to 8kB.
(BeginRead): increase pendingReads earlier and even when reading from
the internal buffer.
(EndRead): decrease pendingReads later and always.
svn path=/trunk/mcs/; revision=36993
* WebConnection.cs:
* WebConnectionGroup.cs: the requests queue is now shared for all the
connections belonging to the same connection group.
svn path=/trunk/mcs/; revision=23695
* WebConnection.cs: Data.Init is a bad boy. Lluis realized. He also
tidied up the end of ReadDone. Disabled relaunching the request if 2
InitRead are called, since now we don't throw everything into
RegisterWaitForSingleObject but one request at a time.
* WebConnectionGroup.cs: when checking available connections, allow them
not to be Connected but allocated to honor the connection limit.
* WebConnectionStream.cs: CheckComplete() now checks for nextReadCalled
too. ReadAll don't mess contentLength if it's provided in the headers.
BIG thanks to Lluis. Turns out that we were debugging the same stuff and
his Data.Init discovery was THE thing I was missing.
Fixes bug #51277.
svn path=/trunk/mcs/; revision=21883
* WebConnection.cs: turns out that socket.Connected is not useful until
we actually try to send/receive data, even if the other end has already
closed the socket. Added TryReconnect() and Connected.
* WebConnectionData.cs: default value for StatusCode is 0 now.
* WebConnectionGroup.cs: reuse the connection since the beginning,
instead of opening up to ConnectionLimit and then reusing.
* WebConnectionStream.cs: reopen the socket if we're trying to reuse
one which fails on first write.
svn path=/trunk/mcs/; revision=20117
* System.Net/ServicePoint.cs: preparing for recycling. Not yet finished.
* System.Net/ServicePointManager.cs: this is the one that reads config.
* System.Net/WebConnectionGroup.cs: don't read config here.
* System.Net/WebConnection.cs: added the queue again. Launch queued
requests on error.
* System.Net.Configuration/ConnectionManagementHandler.cs: the hashtable
is case insensitive now.
svn path=/trunk/mcs/; revision=18788
* System.Net/WebConnection.cs: the queue is now handled by the
threadpool. Initialize the connection data in a place where it does not
depend on the execution order of the requests in threadpool. More error
handling.
* System.Net/WebConnectionGroup.cs: use the limits in the config file
and reuse connections when the limit is reached.
* System.Net.Configuration/ConnectionManagementHandler.cs: added
GetMaxConnections to return the max. number of simultaneous connections
to a given host.
svn path=/trunk/mcs/; revision=18735
* ServicePoint.cs: Removed Connect and GetEndPoint methods.
Removed reverse resolution when uri is literal IP address.
* WebConnection.cs: IPv6 compatibility update: Try to connect
to all addresses returned by IPHostEntry.
* WebConnectionGroup.cs: Removed unused parameter.
svn path=/trunk/mcs/; revision=16209