public GetServerResponse Handle(GetServerRequest request) { var serverAvailable = _socketRepository.ContainsServer(); var serverOffer = _socketRepository.GetServer()?.Offer ?? string.Empty; return(new GetServerResponse(serverAvailable, serverOffer)); }
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)); }
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)); } }