indigophox commented on code in PR #40071:
URL: https://github.com/apache/arrow/pull/40071#discussion_r1491918244


##########
cpp/src/arrow/flight/transport/grpc/grpc_server.cc:
##########
@@ -336,21 +406,35 @@ class GrpcServiceHandler final : public 
FlightService::Service {
       if (instance != nullptr) {
         flight_context.middleware_.push_back(instance);
         flight_context.middleware_map_.insert({factory.first, instance});
-        instance->SendingHeaders(&outgoing_headers);
       }
     }
 
+    // TODO factor this out after fixing all streaming and non-streaming 
handlers
+    if (!skip_headers) {
+      addMiddlewareHeaders(context, flight_context);
+    }
+
     return ::grpc::Status::OK;
   }
 
+  void addMiddlewareHeaders(ServerContext* context,

Review Comment:
   And all of that said, to truly fix this issue everywhere we do need to 
inject it as a hook into the stream wrappers so that it can be called between 
"most of" the Flight server's handler code and when response(s) are written to 
the stream—so not just everywhere we return to gRPC or anywhere we can call it 
explicitly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to