Example #1
0
        public async Task <NodeGreetingMessage> VerifyRemoteGreetingAsync(HashSet <NodeType> expectedNodeTypes, CancellationToken cancellationToken)
        {
            var remoteGreeting = await ReadGreetingAsync(cancellationToken).ConfigureAwait(false);

            if (!expectedNodeTypes.Contains(remoteGreeting.NodeType))
            {
                throw new RedFoxProtocolException(
                          String.Format("Remote greeting node type was {0} but expected node type are: {1}", remoteGreeting.NodeType, FormatHelpers.FormatHashSet(expectedNodeTypes)));
            }
            return(remoteGreeting);
        }
Example #2
0
        public NodeGreetingMessage VerifyRemoteGreeting(HashSet <NodeType> expectedNodeTypes)
        {
            var remoteGreeting = ReadGreeting();

            if (!expectedNodeTypes.Contains(remoteGreeting.NodeType))
            {
                throw new RedFoxProtocolException(
                          String.Format("Remote greeting node type was {0} but expected node type are: {1}", remoteGreeting.NodeType, FormatHelpers.FormatHashSet(expectedNodeTypes)));
            }
            return(remoteGreeting);
        }