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


##########
test/brpc_rdma_unittest.cpp:
##########
@@ -1731,10 +1751,431 @@ rdma::RdmaHello MakeValidV3Hello() {
     return msg;
 }
 
+// A raw peer can reject v3 exactly as an old server would, without adding a
+// server-side version flag or requiring RDMA hardware.
+class RdmaHandshakeRetryTest : public RdmaTest {
+protected:
+    RdmaHandshakeRetryTest() : _started(false) {}
 
-TEST_F(RdmaTest, v3_client_hello_bytes_baseline) {
-    HandshakeVersionFlag _hsv(3);
+    void SetUp() override {
+        _listener.reset(butil::tcp_listen(butil::EndPoint(g_ep.ip, 0)));
+        ASSERT_GE(_listener, 0);
+        ASSERT_EQ(0, butil::get_local_side(_listener, &g_ep));
+    }
 
+    void TearDown() override {
+        if (_socket && !_socket->Failed()) {
+            _socket->SetFailed(ECANCELED, "Handshake test finished");
+        }
+        if (_started) {
+            bthread_id_join(_cntl.call_id());
+        }
+        RdmaTest::TearDown();
+    }
+
+    void StartRpc(int connect_timeout_ms = 2000) {
+        ChannelOptions options;
+        options.socket_mode = SOCKET_MODE_RDMA;
+        options.connection_type = CONNECTION_TYPE_SINGLE;
+        options.connect_timeout_ms = connect_timeout_ms;
+        options.timeout_ms = 5000;
+        options.max_retry = 0;
+        ASSERT_EQ(0, _channel.Init(g_ep, &options));
+        _req.set_message("handshake retry");
+        _started = true;
+        test::EchoService::Stub(&_channel).Echo(&_cntl, &_req, &_res, 
DoNothing());
+        ASSERT_EQ(0, Socket::Address(_cntl._single_server_id, &_socket));
+    }
+
+    int AcceptPeer() {
+        return ::AcceptPeer(_listener);

Review Comment:
   This appears to be a false positive. Both `namespace rdma` and `namespace 
brpc` are closed at lines 96–97, before `static int AcceptPeer(int listener)` 
is defined at line 167. The helper therefore belongs to the global namespace.
   
   `::AcceptPeer(_listener)` correctly selects that helper and avoids name 
hiding by the fixture’s zero-argument `AcceptPeer()` member. Changing it to 
`brpc::rdma::AcceptPeer` would reference a nonexistent function.



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