public static AckImpl CreateAckFunction(TaskCompletionSource <StartMatchBackfillOutcome> future) { return(new AckImpl((ack, response) => { log.DebugFormat("Got ack {0} with response {1}", ack, response); if (null == ack) { future.TrySetResult(new StartMatchBackfillOutcome(new GameLiftError(GameLiftErrorType.SERVICE_CALL_FAILED))); return; } var success = (bool)ack; if (success) { var deserialized = JsonConvert.DeserializeObject <BackfillMatchmakingResponse>(response as string); var translation = BackfillDataMapper.ParseFromBufferedBackfillMatchmakingResponse(deserialized); future.TrySetResult(new StartMatchBackfillOutcome(translation)); } else { future.TrySetResult(new StartMatchBackfillOutcome(new GameLiftError(GameLiftErrorType.SERVICE_CALL_FAILED))); } })); }
AckImpl CreateAckFunction(TaskCompletionSource <StartMatchBackfillOutcome> future) { return(new AckImpl((ack, response) => { log.DebugFormat("Got ack {0} with response {1}", ack, response); if (null == ack) { future.TrySetResult(new StartMatchBackfillOutcome(new GameLiftError(GameLiftErrorType.SERVICE_CALL_FAILED))); return; } var success = (bool)ack; if (success) { var deserialized = Com.Amazon.Whitewater.Auxproxy.Pbuffer.BackfillMatchmakingResponse.Parser.ParseJson(response as string); var translation = BackfillDataMapper.ParseFromBufferedBackfillMatchmakingResponse(deserialized); future.TrySetResult(new StartMatchBackfillOutcome(translation)); } else { SetFutureErrorResult(future, response); } })); }
public async Task <GenericOutcome> StopMatchmaking(StopMatchBackfillRequest request) { var stopMatchmakingRequest = BackfillDataMapper.CreateBufferedStopMatchmakingRequest(request); var response = await SendAsync(stopMatchmakingRequest).ConfigureAwait(false); return(ParseHttpResponse(response)); }
public GenericOutcome StopMatchmaking(Aws.GameLift.Server.Model.StopMatchBackfillRequest request) { var translation = BackfillDataMapper.CreateBufferedStopMatchmakingRequest(request); var future = new TaskCompletionSource <GenericOutcome>(); var ackFunction = CreateAckFunction(future); return(EmitEvent(translation, ackFunction, future, STOP_MATCH_BACKFILL_ERROR)); }
public GenericOutcome StopMatchmaking(StopMatchBackfillRequest request) { log.DebugFormat("Stopping matchmaking backfill for ticket={0}", request.TicketId); var stopMatchmaking = BackfillDataMapper.CreateBufferedStopMatchmakingRequest(request); var future = new TaskCompletionSource <GenericOutcome>(); var ackFunction = CreateAckFunction(future); return(EmitEvent(stopMatchmaking, ackFunction, future, STOP_MATCH_BACKFILL_ERROR)); }
public StartMatchBackfillOutcome BackfillMatchmaking(StartMatchBackfillRequest request) { log.DebugFormat("Backfilling matchmaking for ticket={0}", request.TicketId); var backfillMatchmaking = BackfillDataMapper.CreateBufferedBackfillMatchmakingRequest(request); var future = new TaskCompletionSource <StartMatchBackfillOutcome>(); var ackFunction = CreateAckFunction(future); return(EmitEvent(backfillMatchmaking, ackFunction, future, START_MATCH_BACKFILL_ERROR)); }
public async Task <StartMatchBackfillOutcome> BackfillMatchmaking(StartMatchBackfillRequest request) { var body = BackfillDataMapper.CreateBufferedBackfillMatchmakingRequest(request); var response = await SendAsync(body).ConfigureAwait(false); if (response.IsSuccessStatusCode) { var deserialized = BackfillMatchmakingResponse.Parser.ParseJson(await response.Content.ReadAsStringAsync().ConfigureAwait(false)); var translation = BackfillDataMapper.ParseFromBufferedBackfillMatchmakingResponse(deserialized); new StartMatchBackfillOutcome(translation); } return(new StartMatchBackfillOutcome(new GameLiftError(GameLiftErrorType.SERVICE_CALL_FAILED))); }