void Dispose(bool disposing)
        {
            disposed = true;

            if (disposing)
            {
                if (disposed || Interlocked.CompareExchange(ref in_progress, 0, 0) != 0)
                {
                    return;
                }
                if (Worker != null)
                {
                    Worker.Dispose();
                    Worker = null;
                }
            }
            AcceptSocket   = null;
            Buffer         = null;
            BufferList     = null;
            RemoteEndPoint = null;
            UserToken      = null;
#if !NET_2_1
            SendPacketsElements = null;
#endif
        }
        public SocketAsyncEventArgs()
        {
            Worker                = new SocketAsyncWorker(this);
            AcceptSocket          = null;
            Buffer                = null;
            BufferList            = null;
            BytesTransferred      = 0;
            Count                 = 0;
            DisconnectReuseSocket = false;
            LastOperation         = SocketAsyncOperation.None;
            Offset                = 0;
            RemoteEndPoint        = null;
#if !NET_2_1
            SendPacketsElements = null;
            SendPacketsFlags    = TransmitFileOptions.UseDefaultWorkerThread;
#endif
            SendPacketsSendSize = -1;
            SocketError         = SocketError.Success;
            SocketFlags         = SocketFlags.None;
            UserToken           = null;
        }
Example #3
0
        public void Init(Socket socket, object state, AsyncCallback callback, SocketOperation operation, SocketAsyncWorker worker)
        {
            this.socket      = socket;
            this.is_blocking = socket != null ? socket.is_blocking : true;
            this.handle      = socket != null ? socket.Handle : IntPtr.Zero;
            this.state       = state;
            this.callback    = callback;
            this.operation   = operation;

            if (wait_handle != null)
            {
                ((ManualResetEvent)wait_handle).Reset();
            }

            delayed_exception = null;

            EndPoint      = null;
            Buffer        = null;
            Offset        = 0;
            Size          = 0;
            SockFlags     = SocketFlags.None;
            AcceptSocket  = null;
            Addresses     = null;
            Port          = 0;
            Buffers       = null;
            ReuseSocket   = false;
            accept_socket = null;
            total         = 0;

            completed_synchronously = false;
            completed    = false;
            is_blocking  = false;
            error        = 0;
            async_result = null;
            EndCalled    = 0;
            Worker       = worker;
        }
Example #4
0
		public void Init (Socket socket, object state, AsyncCallback callback, SocketOperation operation, SocketAsyncWorker worker)
		{
			this.socket = socket;
			this.is_blocking = socket != null ? socket.is_blocking : true;
			this.handle = socket != null ? socket.Handle : IntPtr.Zero;
			this.state = state;
			this.callback = callback;
			this.operation = operation;

			if (wait_handle != null)
				((ManualResetEvent) wait_handle).Reset ();

			delayed_exception = null;

			EndPoint = null;
			Buffer = null;
			Offset = 0;
			Size = 0;
			SockFlags = SocketFlags.None;
			AcceptSocket = null;
			Addresses = null;
			Port = 0;
			Buffers = null;
			ReuseSocket = false;
			accept_socket = null;
			total = 0;

			completed_synchronously = false;
			completed = false;
			is_blocking = false;
			error = 0;
			async_result = null;
			EndCalled = 0;
			Worker = worker;
		}
Example #5
0
		void QueueSocketAsyncResult (Queue<SocketAsyncWorker> queue, SocketAsyncWorker worker, SocketAsyncResult sockares)
		{
			int count;
			lock (queue) {
				queue.Enqueue (worker);
				count = queue.Count;
			}

			if (count == 1)
				socket_pool_queue (SocketAsyncWorker.Dispatcher, sockares);
		}
		void Dispose (bool disposing)
		{
			disposed = true;

			if (disposing) {
				if (disposed || Interlocked.CompareExchange (ref in_progress, 0, 0) != 0)
					return;
				if (Worker != null) {
					Worker.Dispose ();
					Worker = null;
				}
			}
			AcceptSocket = null;
			Buffer = null;
			BufferList = null;
			RemoteEndPoint = null;
			UserToken = null;
#if !NET_2_1
			SendPacketsElements = null;
#endif
		}		
		public SocketAsyncEventArgs ()
		{
			Worker = new SocketAsyncWorker (this);
			AcceptSocket = null;
			Buffer = null;
			BufferList = null;
			BytesTransferred = 0;
			Count = 0;
			DisconnectReuseSocket = false;
			LastOperation = SocketAsyncOperation.None;
			Offset = 0;
			RemoteEndPoint = null;
#if !NET_2_1
			SendPacketsElements = null;
			SendPacketsFlags = TransmitFileOptions.UseDefaultWorkerThread;
#endif
			SendPacketsSendSize = -1;
			SocketError = SocketError.Success;
			SocketFlags = SocketFlags.None;
			UserToken = null;
		}