Commit Graph
39 Commits
Author SHA1 Message Date
michaldobrodenka 7174b069cf Fix for ObjectDiposedException in DispatcherCB class
https://bugzilla.xamarin.com/show_bug.cgi?id=23700
2014-10-27 13:28:59 +01:00
Ed Boren 0c55c45450 ConnectCallback needs to call EndConnect
Socket.ConnectAsync uses BeginConnect, and ends here in
ConnectCallback. It needs to call EndConnect so any error can be
propagated up.

See Xamarin bug: https://bugzilla.xamarin.com/show_bug.cgi?id=21017
2014-07-07 13:25:51 -04:00
Robert Pickering fb2f5e0a2f Allow .NET 4.0 + users to use the ConnectSocket property 2014-04-24 07:34:27 +02:00
Rodrigo Kumpera 5007c14d62 Kill the MOONLIGHT define in System. 2013-02-11 13:01:11 -05:00
Gonzalo Paniagua Javier b96b00cb9d Internal worker is kept while there is an ongoing operation
When there is an ongoing operation we can't dispose the internal
	worker because it might be used by the IO threadpool.

	Fixes Novell bug #691076 and Xamarin bug #766.
2011-09-13 00:01:38 -04:00
ualtinok cef86e8e61 Made Count setter internal ->
Set Count to 0 as well as BytesTransferred when reusing a SocketAsyncEventArgs
2011-05-04 07:44:55 -07:00
Gonzalo Paniagua Javier 17085447d7 [Socket] Improved ConnectAsync
ConnectAsync() now uses the improved BeginConnect.
2011-04-26 19:45:16 -04:00
Gonzalo Paniagua Javier db66b0e930 Reset BytesTransferred on every reuse. 2011-03-29 13:46:17 -04:00
Gonzalo Paniagua Javier 36d63134e5 [Socket] Remove more auto-delegates 2011-03-10 19:05:17 -05:00
Gonzalo Paniagua Javier e5074473d6 Handle closed sockets in the callbacks
Accept returns a Socket in AcceptSocket even when the listener is closed.
	Handle ObjectDisposedException for the other callbacks.

	Fixes bug #657593.
2010-12-04 23:29:14 -05:00
Sebastien Pouliot e8de8115ad Remove outdated MonoTODO
* SocketAsyncEventArgs.cs: Remove TODO on SocketClientAccessPolicy
Protocol property
2010-10-13 13:03:40 -04:00
Sebastien Pouliot 31485d3ee7 [moon] Move policy restriction / elevated trust check outside of loop
* System.Net.Sockets/SocketAsyncEventArgs.cs: Move policy restriction
and elevated trust check outside of loop since its value won't change
based on the ipaddress
2010-09-29 14:33:19 -04:00
Sebastien Pouliot 7f2949053b Fix Socket.RemoteEndPoint after ConnectAsync on Moonlight
* System.Net.Sockets/SocketAsyncEventArgs.cs: Set the Socket
RemoteEndPoint to our RemoteEndPoint on Connect operation.
* System.Net.Sockets/Socket_2_1.cs: Return the 'candidate' EndPoint
provided by SocketAsyncEventArgs in ConnectAsync (intead of null)
until the connection is completed.
2010-09-27 20:10:38 -04:00
Gonzalo Paniagua Javier 145726835e Set LastOperation properly
SocketAsyncEventArgs.LastOperation is set when the operation is
	invoked.
	Reset the error status before each new *Async() call.
2010-09-27 00:27:04 -04:00
Gonzalo Paniagua Javier 2d0c85f412 ConnectAsync() security checks
-ConnectAsync() changed to make security checks for all endpoints before
	trying to connect for the first time.
	-Use the socket Connect() call instead of repeating the same stuff.
	Connect should be splitted in 2 pieces (DNS + Connection attempts).
2010-09-25 18:37:30 -04:00
Gonzalo Paniagua Javier 3ed061749e Added support for ArraySegment
-Removed NET_2_0
	-Implemented support for the Receive/Send overloads that take a list of
	ArraySegments.
2010-09-25 18:37:30 -04:00
Gonzalo Paniagua Javier f3463e7232 Made the moonlight profile happy.
Disabled operations not allowed under moonlight.
2010-09-25 14:08:13 -04:00
Gonzalo Paniagua Javier 61d0f84376 Rework SocketAsyncEventArgs internals
-Removed #if NET_2_0
	-All the *Async() calls but ConnectAsync() are routed through the
	asynch IO threadpool instead of creating a new short-lived thread for
	every operation.
	-When reusing a SocketAsyncEventArgs only 1 new object, a delegate, is
	created.
2010-09-25 12:37:27 -04:00
Sebastien Pouliot 240f7e8f1d update System.Net.dll for SL4 API
svn path=/trunk/mcs/; revision=155874
2010-04-21 14:03:45 +00:00
Sebastien Pouliot 355a27b73d In System.Timers:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* Timer.cs: Removed old NET_2_0 defines and added some new
	MOONLIGHT defines (needed for the client stack)

In System.Net:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* AuthenticationManager.cs: Internal type for Moonlight.
	Add BasicClient, DigestClient, NtlmClient for NET_2_1 since
	this applies to both monotouch and moonlight (client stack).
	Removed unneeded NET_2_0 defines
	* CookieContainer.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll. Removed unneeded NET_2_0
	defines
	* HttpContinueDelegate.cs: Internal type for Moonlight.
	* HttpRequestCreator.cs: Remove a MOONLIGHT define
	* HttpStatusCode.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll
	* HttpWebRequest.cs: Internal type for Moonlight. Change S.Config
	to NET_2_1 defines (applies to both monotouch and moonlight).
	Removed unneeded NET_2_0 and NET_1_1 defines
	* HttpWebResponse.cs: Internal type for Moonlight. Removed 
	unneeded NET_2_0 defines
	* IAuthenticationModule.cs: Internal type for Moonlight.
	* ICertificatePolicy.cs: Internal type for Moonlight.
	* ICredentialPolicy.cs: Internal type for Moonlight. Removed 
	unneeded NET_2_0 defines
	* IWebRequestCreate.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll
	* ServicePoint.cs: Internal type for Moonlight. Change S.Config
	to NET_2_1 defines (applies to both monotouch and moonlight)
	* ServicePointManager.cs: Remove a MOONLIGHT define
	* WebException.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll. Removed unneeded NET_2_0
	defines
	* WebHeaderCollection.cs: Internal type for Moonlight. Removed 
	unneeded NET_2_0 defines
	* WebRequest.cs: Internal type for Moonlight. Change S.Config
	to NET_2_1 defines (applies to both monotouch and moonlight)
	* WebResponse.cs: Internal type for Moonlight. Removed unneeded
	NET_2_0 defines

In System.Net.Sockets:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* Socket.cs: Remove some NET_2_0 defines (using) and add a few
	MOONLIGHT defines needed to reuse Socket in the client http stack
	* Socket_2_1.cs: Remove some MOONLIGHT defines
	* SocketAsyncEventArgs.cs: For Moonlight check policy if outside
	System.dll (the client stack use sockets with it's own web 
	xdomain policy)

In System:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* Uri.cs: Remove some MOONLIGHT defines

In .:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* moonlight_*_System.dll.sources: Bring extra types so we can
	build a full, managed, internal HTTP stack to be reused for SL3+
	* Makefile: Add a INSIDE_SYSTEM define when compiling System.dll
	to makes it possible to rebuild the same types in System.Net.dll


svn path=/trunk/mcs/; revision=153916
2010-03-19 19:01:31 +00:00
Jb Evain ba61ae505e use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153655
2010-03-16 12:07:46 +00:00
Sebastien Pouliot c54a75466f In System/System.Net.Sockets:
2010-03-10  Sebastien Pouliot  <[email protected]>

	* SocketAsyncEventArgs.cs: Remove the use of reflection to check
	xdomain poilicy on sockets (since the policy code now resides in
	System.Net.dll)

In System.Net:
2010-03-10  Sebastien Pouliot  <[email protected]>

	* net_2_1_raw_System.Net.dll.sources: Add types from (new internal)
	System.Net.Policy (moved from System.Windows.Browser.dll)
	* Makefile: Add reference to System.Xml.dll to parse policies

In System.Net/System.Net.Policy:
2010-03-10  Sebastien Pouliot  <[email protected]>

	* BaseDomainPolicy.cs, ClientAccessPolicy[Parser].cs, 
	CrossDomainPolicyManager.cs, FlashCrossDomainPolicy[Parser].cs,
	ICrossDomainPolicy.cs, NoAccessPolicy.cs, PolicyDownloadPolicy.cs,
	SiteOfOriginPolicy.cs: Moved from System.Net.dll with namespace 
	and minor build adjustments.


svn path=/trunk/mcs/; revision=153396
2010-03-10 13:19:46 +00:00
Sebastien Pouliot 33bb7e756a 2010-01-21 Sebastien Pouliot <[email protected]>
* SocketAsyncEventArgs.cs: Apply Gendarme's ProtectCallToEventDelegatesRule


svn path=/trunk/mcs/; revision=150033
2010-01-22 01:50:48 +00:00
Sebastien Pouliot f2a2bf9ffb move DnsEndPoint to ease 4.0
svn path=/trunk/mcs/; revision=147700
2009-12-04 20:16:55 +00:00
Sebastien Pouliot e818e02eee 2009-11-03 Sebastien Pouliot <[email protected]>
* SocketAsyncEventArgs.cs: Set error back to SocketError.Success
	once CheckEndPoint succeed.
	[Fix bug #549586]


svn path=/trunk/mcs/; revision=145329
2009-11-03 21:57:55 +00:00
Sebastien Pouliot 2763f57c1c 2009-09-28 Sebastien Pouliot <[email protected]>
* SocketAsyncEventArgs.cs: Default SocketError.AccessDenied on 
	Connect in case none of the DnsEndPoint provides an adequate 
	address (family).


svn path=/trunk/mcs/; revision=142746
2009-09-28 12:02:47 +00:00
Sebastien Pouliot e0ce50685b 2009-09-27 Sebastien Pouliot <[email protected]>
* SocketAsyncEventArgs.cs: Don't use Socket.Poll for NET_2_1.
	Throw NIE for use of BufferList in Receive.
	* Socket.cs: Move Close(int) to Socket_2_1.cs. Remove NET_2_1
	defines since the file is not used by Moonlight
	* Socket_2_1.cs: Add Close(int) from Socket. Define out Poll
	and Blocking.


svn path=/trunk/mcs/; revision=142722
2009-09-27 14:51:42 +00:00
Sebastien Pouliot 0328ff83e6 In Test/System.Net.Sockets:
2009-09-26  Sebastien Pouliot  <[email protected]>

	* SocketAsyncEventArgsTest.cs: New. Unit tests

In System.Net.Sockets:
2009-09-26  Sebastien Pouliot  <[email protected]>

	* SocketAsyncEventArgs.cs: Fix paramater validations and default 
	values

In .:
2009-09-26  Sebastien Pouliot  <[email protected]>

	* System_test.dll.sources: Add unit tests for SocketAsyncEventArgs


svn path=/trunk/mcs/; revision=142675
2009-09-26 15:27:35 +00:00
Sebastien Pouliot 94a90d2d71 2009-09-23 Sebastien Pouliot <[email protected]>
* Socket_2_1.cs: Remove NET_2_1 socket policy checks from here.
	* SocketAsyncEventArgs.cs: Support DnsEndPoint correctly (NET_2_1 but
	that will be useful for NET_4_0 soon). Add socket policy checks here
	since it could be called several times to connect to a host.


svn path=/trunk/mcs/; revision=142518
2009-09-23 21:39:08 +00:00
Gonzalo Paniagua Javier ea0c9270a9 2009-09-19 Gonzalo Paniagua Javier <[email protected]>
* SocketAsyncEventArgs.cs: fix check for non-null.
	Fixes bug #516455.


svn path=/trunk/mcs/; revision=142252
2009-09-19 05:03:02 +00:00
Sebastien Pouliot 4d12f1bee0 2009-07-14 Sebastien Pouliot <[email protected]>
* Socket_2_1.cs, SocketAsyncEventArgs.cs: A bit more NET_2_1 defines
	to help the tuner remove some extra types for moonlight.


svn path=/trunk/mcs/; revision=137855
2009-07-14 12:21:46 +00:00
Sebastien Pouliot 81c2b840f7 2009-05-22 Sebastien Pouliot <[email protected]>
* Socket_2_1.cs: Do not throw a SecurityException if the security
	policy check fails in NET_2_1 but set the SocketError to AccessDenied
	ensure the EndPoint has a valid policy before connecting.
	* SocketAsyncEventArgs.cs: Don't recurse endlessly in SendCallback
	and ReceiveCallback if the socket is not connected. Check for
	AccessDenied in ConnectCallback (needed for the security policy
	check in NET_2_1).


svn path=/trunk/mcs/; revision=134596
2009-05-22 13:58:03 +00:00
Sebastien Pouliot 16d3fe2785 2009-05-14 Sebastien Pouliot <[email protected]>
* Socket_2_1.cs: Add ConnectAsync support for NET_2_1 which will
	ensure the EndPoint has a valid policy before connecting.
	* SocketAsyncEventArgs.cs: Add support for IList<ArraySegment<byte>>
	when sending. Add ConnectSocket for NET_2_1


svn path=/trunk/mcs/; revision=134171
2009-05-15 00:31:55 +00:00
Sebastien Pouliot 68dd206d83 In System.Net.Sockets:
2009-04-09  Sebastien Pouliot  <[email protected]>

	* Socket.cs: Split socket class into two files (this one and the
	new Socket_2_1.cs). This let us remove (some) existing #if in the
	sources and avoid (a lot) of new ones for Moonlight.
	* Socket_2_1.cs: Just enough of socket for NET_2_1. This helps
	the tuner not to bring a lot of extra stuff (some visible)
	into Moonlight.
	* SocketAsyncEventArgs.cs: Ifdef out some cases for NET_2_1 so 
	Moonlight can use it's own (smaller) SocketAsyncOperation enum

In .:
2009-04-09  Sebastien Pouliot  <[email protected]>

	* System.dll.sources: Add System.Net.Sockets/Socket_2_1.cs


svn path=/trunk/mcs/; revision=131392
2009-04-09 15:06:42 +00:00
Miguel de Icaza 67c2ea5d54 Some API updates
svn path=/trunk/mcs/; revision=121931
2008-12-20 18:57:23 +00:00
Marek Safar bdd9de656e Fixed few warnings
svn path=/trunk/mcs/; revision=107455
2008-07-08 10:34:18 +00:00
Stephane Delcroix 84536647a0 2008-06-11 Stephane Delcroix <[email protected]>
* SocketAsyncEventArgs.cs: catch SocketException in ConnectAsync
	and set the SocketError accordingly.

svn path=/trunk/mcs/; revision=105581
2008-06-11 14:07:18 +00:00
Marek Habersack a0fc121d39 2008-05-09 Marek Habersack <[email protected]>
* SocketAsyncEventArgs.cs: implemented support for executing
	asynchronous socket actions, called from the new xxxxAsync methods
	in Socket. The asynchronous operations do not use the ThreadPool
	as I can't get the sample applications to work (send/receive
	callbacks don't work) - it may change in the future.

	* Socket.cs: implemented several xxxxAsync 2.0sp1 methods. The
	ones not implemented for now are: ReceiveMessageFromAsync and
	SendPacketsAsync. AcceptAsync doesn't perform the check for the
	buffer size for now - need to implement runtime support for that.
	Made several methods internal, so that they can be accessed from
	SocketAsyncEventArgs code.

svn path=/trunk/mcs/; revision=102884
2008-05-09 20:11:09 +00:00
Marek Habersack 072bdcccd6 2008-05-08 Marek Habersack <[email protected]>
* SocketAsyncOperation.cs, SendPacketsElement.cs,
	SocketAsyncEventArgs.cs: added initial implementations for
	2.0SP1/3.5 classes used in the (to be implemented) new xxxAsync
	methods of the Socket class.

svn path=/trunk/mcs/; revision=102790
2008-05-08 05:12:35 +00:00