private async ValueTask InvokeAllAsync(OutgoingRequestFrame outgoingRequest, int requestId) { // The object adapter DirectCount was incremented by the caller and we are responsible to decrement it // upon completion. Ice.Instrumentation.IDispatchObserver?dispatchObserver = null; try { if (_traceLevels.Protocol >= 1) { // TODO we need a better API for tracing List <System.ArraySegment <byte> > requestData = Ice1Definitions.GetRequestData(outgoingRequest, requestId); TraceUtil.TraceSend(_adapter.Communicator, VectoredBufferExtensions.ToArray(requestData), _logger, _traceLevels); } var incomingRequest = new IncomingRequestFrame(_adapter.Communicator, outgoingRequest); var current = new Current(_adapter, incomingRequest, requestId); // Then notify and set dispatch observer, if any. Ice.Instrumentation.ICommunicatorObserver?communicatorObserver = _adapter.Communicator.Observer; if (communicatorObserver != null) { dispatchObserver = communicatorObserver.GetDispatchObserver(current, incomingRequest.Size); dispatchObserver?.Attach(); } bool amd = true; try { IObject?servant = current.Adapter.Find(current.Identity, current.Facet); if (servant == null) { amd = false; throw new ObjectNotExistException(current.Identity, current.Facet, current.Operation); } ValueTask <OutgoingResponseFrame> vt = servant.DispatchAsync(incomingRequest, current); amd = !vt.IsCompleted; if (requestId != 0) { OutgoingResponseFrame response = await vt.ConfigureAwait(false); dispatchObserver?.Reply(response.Size); SendResponse(requestId, response, amd); } } catch (System.Exception ex) { if (requestId != 0) { RemoteException actualEx; if (ex is RemoteException remoteEx && !remoteEx.ConvertToUnhandled) { actualEx = remoteEx; } else { actualEx = new UnhandledException(current.Identity, current.Facet, current.Operation, ex); } Incoming.ReportException(actualEx, dispatchObserver, current); var response = new OutgoingResponseFrame(current, actualEx); dispatchObserver?.Reply(response.Size); SendResponse(requestId, response, amd); } } }
public override List <ArraySegment <byte> > GetRequestData(int requestId) => Ice1Definitions.GetRequestData(RequestFrame, requestId);