Пример #1
0
        /// <summary>
        ///		Returns the response context to the pool.
        /// </summary>
        /// <param name="context">The response to the pool.</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="context"/> is  <c>null</c>.
        /// </exception>
        protected internal void ReturnResponseContext(ClientResponseContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            Contract.EndContractBlock();

            context.Clear();
            context.UnboundTransport();
            ResponseContextPool.Return(context);
        }
Пример #2
0
        internal ClientResponseContext GetResponseContext(ClientTransport transport, EndPoint remoteEndPoint)
        {
            Contract.Requires(transport != null);
            Contract.Requires(remoteEndPoint != null);
            Contract.Ensures(Contract.Result <ClientResponseContext>() != null);

            var result = ResponseContextPool.Borrow();

            result.RenewSessionId();
            result.SetTransport(transport);
            result.RemoteEndPoint = remoteEndPoint;
            return(result);
        }