Beispiel #1
0
 public static void TrySetNngError <T>(this CancellationTokenTaskSource <NngResult <T> > socket, int error)
 {
     if (error == 0)
     {
         return;
     }
     socket.TrySetResult(NngResult <T> .Fail(error));
 }
        public Task <T> Receive(CancellationToken token)
        {
            CheckState();

            receiveTcs = new CancellationTokenTaskSource <T>(token);
            State      = AsyncState.Recv;
            nng_recv_aio(Socket.NngSocket, aioHandle);
            return(receiveTcs.Task);
        }
Beispiel #3
0
 public static void TrySetNngResult <T>(this CancellationTokenTaskSource <NngResult <T> > socket, T message)
 {
     socket.TrySetResult(NngResult <T> .Ok(message));
 }
 public AsyncResvMsg(CancellationToken token)
 {
     Source = new CancellationTokenTaskSource <T>(token);
 }
Beispiel #5
0
 public static void TrySetNngError <T>(this CancellationTokenTaskSource <NngResult <T> > socket, NngErrno error)
 {
     socket.TrySetResult(NngResult <T> .Fail(error));
 }