From d3677e569a5580f012d732cdbcc232a1420371fb Mon Sep 17 00:00:00 2001
From: AJ Heller <hork@google.com>
Date: Mon, 19 Apr 2021 16:01:22 -0700
Subject: [PATCH] Return port number from EventEngine::Listener::Bind (#26004)

* Return port number from EventEngine::Listener::Bind

This is an integer, unlike the DNSResolver, since the underlying
bind syscall deals in integers.

* Add return type documentation
---
 include/grpc/event_engine/event_engine.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/grpc/event_engine/event_engine.h b/include/grpc/event_engine/event_engine.h
index 2bdefa78730..c2d0c404903 100644
--- a/include/grpc/event_engine/event_engine.h
+++ b/include/grpc/event_engine/event_engine.h
@@ -160,11 +160,10 @@ class EventEngine {
     virtual ~Listener() = 0;
 
     // TODO(hork): define return status codes
-    // TODO(hork): requires output port argument, return value, or callback
     /// Bind an address/port to this Listener. It is expected that multiple
     /// addresses/ports can be bound to this Listener before Listener::Start has
-    /// been called.
-    virtual absl::Status Bind(const ResolvedAddress& addr) = 0;
+    /// been called. Returns the bound port or an error status.
+    virtual absl::StatusOr<int> Bind(const ResolvedAddress& addr) = 0;
     virtual absl::Status Start() = 0;
   };