| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using IceRpc.Internal; |
| | 4 | | using System.IO.Pipelines; |
| | 5 | |
|
| | 6 | | namespace IceRpc; |
| | 7 | |
|
| | 8 | | /// <summary>Provides an extension method for <see cref="IncomingFrame" /> to detach its payload.</summary> |
| | 9 | | public static class IncomingFrameExtensions |
| | 10 | | { |
| | 11 | | /// <summary>Detaches the payload from the incoming frame. The caller takes ownership of the returned payload |
| | 12 | | /// pipe reader, and <see cref="IncomingFrame.Payload" /> becomes invalid.</summary> |
| | 13 | | /// <param name="incoming">The incoming frame.</param> |
| | 14 | | /// <returns>The payload pipe reader.</returns> |
| | 15 | | public static PipeReader DetachPayload(this IncomingFrame incoming) |
| 68 | 16 | | { |
| 68 | 17 | | PipeReader payload = incoming.Payload; |
| 68 | 18 | | incoming.Payload = InvalidPipeReader.Instance; |
| 68 | 19 | | return payload; |
| 68 | 20 | | } |
| | 21 | | } |