public static (IQueueItem, Task <TResponseType?>) Create( bool mutatesSolutionState, bool requiresLSPSolution, ClientCapabilities clientCapabilities, string methodName, TextDocumentIdentifier?textDocument, TRequestType request, IRequestHandler <TRequestType, TResponseType> handler, Guid activityId, ILspLogger logger, RequestTelemetryLogger telemetryLogger, CancellationToken cancellationToken) { var queueItem = new QueueItem <TRequestType, TResponseType>( mutatesSolutionState, requiresLSPSolution, clientCapabilities, methodName, textDocument, request, handler, activityId, logger, telemetryLogger, cancellationToken); return(queueItem, queueItem._completionSource.Task); }
public QueueItem( bool mutatesSolutionState, bool requiresLSPSolution, ClientCapabilities clientCapabilities, string methodName, TextDocumentIdentifier?textDocument, TRequestType request, IRequestHandler <TRequestType, TResponseType> handler, Guid activityId, ILspLogger logger, RequestTelemetryLogger telemetryLogger, CancellationToken cancellationToken) { // Set the tcs state to cancelled if the token gets cancelled outside of our callback (for example the server shutting down). cancellationToken.Register(() => _completionSource.TrySetCanceled(cancellationToken)); Metrics = new RequestMetrics(methodName, telemetryLogger); _handler = handler; _logger = logger; _request = request; ActivityId = activityId; MutatesSolutionState = mutatesSolutionState; RequiresLSPSolution = requiresLSPSolution; ClientCapabilities = clientCapabilities; MethodName = methodName; TextDocument = textDocument; }
internal static TRequestType CreateRequestType <TRequestType>() where TRequestType : BaseRequest, new() { var item = new TRequestType { Username = Username, Password = Password }; return(item); }
private void AddRequest(TRequestType request, Exchange exchange) { lock (_Requests) { _Requests.Enqueue(new ClientRequest() { RequestType = request, Exchange = exchange }); } _TriggerProcessRequests.Set(); }
void IMessageDeliverer.DeliverRequest(Exchange exchange) { Request request = exchange.Request; TRequestType requestType = TRequestType.NotSet; if (request.Method == Method.POST) { if (request.URI.AbsolutePath == "/bs") { requestType = TRequestType.RequestBootstrap; } } if (requestType == TRequestType.NotSet) { exchange.SendReject(); } else { AddRequest(requestType, exchange); } }
void IMessageDeliverer.DeliverRequest(Exchange exchange) { Request request = exchange.Request; TRequestType requestType = TRequestType.NotSet; if (request.Method == Method.POST) { if (request.URI.AbsolutePath == "/rd") { if ((request.ContentType == (int)MediaType.ApplicationLinkFormat) || (request.ContentType == -1)) //if (request.ContentType == (int)MediaType.ApplicationLinkFormat) { requestType = TRequestType.Register; } } } if (request.URI.AbsolutePath.StartsWith("/rd/")) { if ((request.Method == Method.POST) || (request.Method == Method.PUT)) { requestType = TRequestType.Update; } else if (request.Method == Method.DELETE) { requestType = TRequestType.Deregister; } } if (requestType == TRequestType.NotSet) { exchange.SendReject(); } else { AddRequest(requestType, exchange); } }
public RequestArg(TRequestType _type) { eType = _type; }