public override Task <WaitForEventResponse> WaitForEvent(WaitForEventRequest request, ServerCallContext context) { SbListener listener; if (!_listenerStore.TryGetValue(request.Listener.Id, out listener)) { ErrorUtils.ThrowError( StatusCode.Internal, "Could not find listener in store: " + request.Listener.Id); } SbEvent evnt; bool result = listener.WaitForEvent(request.NumSeconds, out evnt); var response = new WaitForEventResponse { Result = result, }; if (result) { response.Event = new GrpcSbEvent { Type = (uint)evnt.GetEventType(), Description = evnt.GetDescription(), HasProcessResumed = evnt.GetProcessRestarted(), IsBreakpointEvent = _breakpointApi.EventIsBreakpointEvent(evnt) }; if ((evnt.GetEventType() & EventType.STATE_CHANGED) != 0) { response.Event.StateType = StateTypeToProto(evnt.GetStateType()); } if (response.Event.IsBreakpointEvent) { response.Event.BreakpointData = new GrpcEventBreakpointData { EventType = (uint)_breakpointApi.GetBreakpointEventTypeFromEvent(evnt), BreakpointId = _breakpointApi.GetBreakpointFromEvent(evnt).GetId(), }; } } return(Task.FromResult(response)); }
public bool WaitForEvent(uint numSeconds, out SbEvent evnt) { WaitForEventResponse response = null; if (connection.InvokeRpc(() => { response = client.WaitForEvent( new WaitForEventRequest { Listener = grpcListener, NumSeconds = numSeconds, }); })) { if (response.Result) { evnt = eventFactory.Create(response.Event); return(true); } } evnt = null; return(false); }