public void RemoveRequest(Request request)
		{
            _request = null;
		}
		public void AddRequest(Request request)
		{
            _request = request;
		}
Ejemplo n.º 3
0
        private IEnumerable<Message> CreateEndRequestMessages(Request request)
        {
            yield return new Message(MessageType.StandardError, request.Id, ByteArray.Empty);
			yield return new Message(MessageType.StandardOutput, request.Id, ByteArray.Empty);

            var body = new EndRequestMessageBody(request.ExitCode, ProtocolStatus.RequestComplete);
			yield return new Message(MessageType.EndRequest, request.Id, body.ToArray());
        }
Ejemplo n.º 4
0
		/// <summary>
		/// Send a request output data to the output or error stream
		/// </summary>
		/// <param name="request">Request</param>
		/// <param name="streamType"></param>
		/// <param name="data"></param>
		protected virtual void SendRequestOutput(Request request, MessageType streamType, ByteArray data)
		{
			if (streamType != MessageType.StandardError &&
				streamType != MessageType.StandardOutput)
					throw new ArgumentException("streamType");

			while (data.Count > 0)
			{
				ushort length = (ushort)Math.Min(data.Count, Consts.MaxMessageBodySize);
				this.SendMessage(new Message(streamType, request.Id, data.SubArray(0, length)));
				data = data.SubArray(length, true);
			}
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Ends a request
		/// </summary>
		/// <param name="request"><typeparamref name="Request"/> to end</param>
		protected virtual void EndRequest(Request request)
		{
            this.SendMessages(this.CreateEndRequestMessages(request));
            _requestsRepository.RemoveRequest(request);
		}