Add stream_id accessors to public API types (#292)
Problem: Applications may want to access the underlying h2 stream ID for diagnostics, etc. Stream IDs were not previously exposed in public APIs. Solution: Added a new public `share::StreamId` type, which has a more restricted API than the internal `frame::StreamId` type. The public API types `SendStream`, `RecvStream`, `ReleaseCapacity`, `client::ResponseFuture`, and `server::SendResponse` now all have `stream_id` methods which return the stream ID of the corresponding stream. Closes #289. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
@@ -988,6 +988,15 @@ impl<B: IntoBuf> SendResponse<B> {
|
||||
self.inner.poll_reset(proto::PollReset::AwaitingHeaders)
|
||||
}
|
||||
|
||||
/// Returns the stream ID of the response stream.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If the lock on the strean store has been poisoned.
|
||||
pub fn stream_id(&self) -> ::StreamId {
|
||||
::StreamId::from_internal(self.inner.stream_id())
|
||||
}
|
||||
|
||||
// TODO: Support reserving push promises.
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user