Exemplo n.º 1
0
        public GetServerResponse Handle(GetServerRequest request)
        {
            var serverAvailable = _socketRepository.ContainsServer();
            var serverOffer     = _socketRepository.GetServer()?.Offer ?? string.Empty;

            return(new GetServerResponse(serverAvailable, serverOffer));
        }
Exemplo n.º 2
0
        public ClientOfferResponse Handle(ClientOfferRequest request)
        {
            var socketData = new SocketData(request.Socket, SocketKind.client, request.Address, request.Offer);

            _socketRepository.OnSocketConnected(socketData);

            var serverAvailable = _socketRepository.ContainsServer();
            var serverOffer     = _socketRepository.GetServer()?.Offer ?? string.Empty;

            return(new ClientOfferResponse(serverAvailable, serverOffer));
        }
Exemplo n.º 3
0
        public AnswerResponse Handle(AnswerRequest request)
        {
            if (_socketRepository.ContainsServer())
            {
                var serverSocket = _socketRepository.GetServer();

                _notifier.SendAnswerToServer(serverSocket, request.AnswerOffer);

                return(new AnswerResponse("Processed", true));
            }
            else
            {
                return(new AnswerResponse("Server not found", false));
            }
        }