Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Sources/GRPCCore/Call/Server/ServerContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ public struct ServerContext: Sendable {
/// - "in-process:27182".
public var localPeer: String

/// An optional field for transports to store specific data
///
/// Refer to the transport documentation to understand what type of
/// value this field will contain, if any.
///
/// An example of what this field can be used for, would be to store
/// things like a peerCertificate from a mTLS connection
public var transportSpecific: (any Sendable)?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this some more, rather than any Sendable can you define a public protocol TransportSpecific: Sendable {} nested within ServerContext and use that instead?

It has a few advantages:

  1. Compiler helps users out a little more
  2. It's easier to document and easier for users to find implementations.


/// A handle for checking the cancellation status of an RPC.
public var cancellation: RPCCancellationHandle

Expand Down