Exemplo n.º 1
0
        internal void Answer <TRequest, TReply>(TRequest value, AbstractAnswerable answerable, LetterOptions options, AnswerCallback <TRequest, TReply> callback)
        {
            ILetter letter      = CreateLetter(value, options | LetterOptions.Ack, answerable.ConversationId);
            var     outstanding = new DelegateOutstanding <TRequest, TReply>(this, value, callback);

            _outstandings.Add(answerable.ConversationId, outstanding);

            _socket.SendTo(letter, answerable.RemoteNodeId);
        }
Exemplo n.º 2
0
        internal IAnswerable <TReply> Answer <TValue, TReply>(TValue value, AbstractAnswerable answerable, LetterOptions options)
        {
            ILetter letter      = CreateLetter(value, options, answerable.ConversationId);
            var     outstanding = new BlockingOutstanding <TReply>(this);

            _outstandings.Add(answerable.ConversationId, outstanding);

            _socket.SendTo(letter, answerable.RemoteNodeId);

            try {
                outstanding.Wait();
            } finally {
                _outstandings.Remove(answerable.ConversationId);
            }

            return(outstanding.Result);
        }
Exemplo n.º 3
0
 internal void Answer <T>(T value, AbstractAnswerable answerable, LetterOptions options)
 {
     _socket.SendTo(CreateLetter(value, options, answerable.ConversationId), answerable.RemoteNodeId);
 }