chenBright commented on code in PR #3720:
URL: https://github.com/apache/brpc/pull/3720#discussion_r4508935273


##########
src/brpc/rdma/rdma_endpoint.h:
##########
@@ -50,51 +49,27 @@ struct ParsedHello;
 enum class RemoteHelloResult;
 class RdmaHello;
 class RdmaEndpoint;
+class SrqConnection;
+
 namespace v2_wire {
-    RemoteHelloResult ReadBodyAndNegotiate(RdmaEndpoint* ep, ParsedHello* 
remote);
-    int DrainBytes(RdmaEndpoint* ep, size_t n);
+RemoteHelloResult ReadBodyAndNegotiate(RdmaEndpoint* ep, ParsedHello* remote);
+int DrainBytes(RdmaEndpoint* ep, size_t n);
 }  // namespace v2_wire
 
 namespace v3_wire {
-    void FillLocalRdmaHello(const RdmaEndpoint* ep, RdmaHello* msg);
-    int  ReadAndParseV3Hello(RdmaEndpoint* ep, RdmaHello* out);
-    int  WriteV3Hello(RdmaEndpoint* ep, const RdmaHello& msg);
+void FillLocalRdmaHello(const RdmaEndpoint* ep, RdmaHello* msg);
+int  ReadAndParseV3Hello(RdmaEndpoint* ep, RdmaHello* out);
+int  WriteV3Hello(RdmaEndpoint* ep, const RdmaHello& msg);
 }  // namespace v3_wire
 
 class RdmaConnect : public AppConnect {
 public:
     void StartConnect(const Socket* socket, 
-            void (*done)(int err, void* data), void* data) override;
-    void StopConnect(Socket*) override;
-    struct RunGuard {
-        RunGuard(RdmaConnect* rc) { this_rc = rc; }
-        ~RunGuard() { if (this_rc) this_rc->Run(); }
-        RdmaConnect* this_rc;
-    };
-
-private:
-    void Run();
-    void (*_done)(int, void*){nullptr};
-    void* _data{nullptr};
+                      void (*done)(int err, void* data), void* data) override;
+    void StopConnect(Socket*) override {}

Review Comment:
   Fixed in a3b3a4a. The handshake now checks `Socket::Failed()` before 
starting, during read/write retries, before QP activation, and before 
completing successfully. The completion guard reports the result exactly once 
and preserves an explicit error value independently of `errno`.
   
   Cancellation follows the per-socket failure state because `Socket` currently 
calls `StopConnect()` only during recycling. Blocked reads observe failure 
through the existing bounded wait.
   
   Added a regression test covering v2/v3, stalled reads, blocked writes, and 
late hello data. It failed before the fix and passes afterward, without 
requiring peer closure or an explicit `StopConnect()` call.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to