Esempio n. 1
0
        internal static void _WriteCallback(IntPtr handle, int status)
        {
            var request = FromIntPtr <UvWriteRequest>(handle);

            foreach (var gcHandle in request._PinnedWriteHandles)
            {
                gcHandle.Free();
            }
            request._PinnedWriteHandles.Clear();

            var callback = request.Callback;

            request.Callback = null;

            var state = request.State;

            request.State = null;

            Exception error;

            Libuv.CheckStatusCode(status, out error);

            if (callback != null)
            {
                callback.Invoke(request, error, state);
            }

            request.Close();
        }
Esempio n. 2
0
        private static void _ListenCallback(IntPtr serverPtr, int status)
        {
            var stream = FromIntPtr <UvNetworkStream>(serverPtr);

            Exception error;

            Libuv.CheckStatusCode(status, out error);

            stream._UserListenCallback.Invoke(stream, error, stream._UserListenState);
        }
Esempio n. 3
0
        private static void _ReadCallback(IntPtr streamPtr, int nread, ref UvBuffer buf)
        {
            var stream = FromIntPtr <UvStream>(streamPtr);

            foreach (var gcHandle in stream._PinnedReadHandles)
            {
                gcHandle.Free();
            }
            stream._PinnedReadHandles.Clear();

            Exception error;

            Libuv.CheckStatusCode(nread, out error);

            stream._UserReadCallback.Invoke(stream, nread, error, stream._UserReadState);
        }
Esempio n. 4
0
        private static void _ConnectCallback(IntPtr handle, int status)
        {
            var request = FromIntPtr <UvTcpConnectRequest>(handle);

            var callback = request.Callback;

            request.Callback = null;

            var state = request.State;

            request.State = null;

            Exception error;

            Libuv.CheckStatusCode(status, out error);

            if (callback != null)
            {
                callback.Invoke(request, error, state);
            }

            request.Close();
        }