예제 #1
0
파일: TCPServer.cs 프로젝트: G-Nobre/PC
        private async Task <Response> TransferMessageIntoQueue(Request req, CancellationToken cancellationtoken)
        {
            AsyncTransferQueue <JObject> queue;

            if (!_asyncQueues.TryGetValue(req, out queue))
            {
                return(_helper.NotFoundForPath());
            }

            if (!req.Headers.TryGetValue("timeout", out string timeout))
            {
                timeout = "0";
            }

            bool result = await queue.TransferAsync(req.Payload, int.Parse(timeout), cancellationtoken);

            return(result ?
                   _helper.OperationSuccessful("Request successfully transfered!") :
                   _helper.TimeoutResponse());
        }
예제 #2
0
 public void NotifyShutdownCompleted()
 {
     request?.SetResult(_httpHelper.OperationSuccessful());
 }