You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by if...@apache.org on 2022/06/30 23:39:45 UTC

[rocketmq-client-cpp] branch master updated: fix: compile error of type conversion

This is an automated email from the ASF dual-hosted git repository.

ifplusor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new cdda900  fix: compile error of type conversion
cdda900 is described below

commit cdda9001b4fcfd3d0fba9b90eff5991f840ba5da
Author: James Yin <yw...@hotmail.com>
AuthorDate: Wed Jun 29 22:08:15 2022 +0800

    fix: compile error of type conversion
---
 src/transport/TcpTransport.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/transport/TcpTransport.cpp b/src/transport/TcpTransport.cpp
index d8c23f9..de3ca8c 100644
--- a/src/transport/TcpTransport.cpp
+++ b/src/transport/TcpTransport.cpp
@@ -207,7 +207,11 @@ void TcpTransport::eventCallback(BufferEvent* event, short what, TcpTransport* t
 
     // disable Nagle
     int val = 1;
-    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, static_cast<const char *>(&val), sizeof(val));
+#ifdef WIN32
+    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const char*>(&val), sizeof(val));
+#else
+    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const void*>(&val), sizeof(val));
+#endif
     transport->setTcpConnectEvent(TCP_CONNECT_STATUS_SUCCESS);
   } else if (what & (BEV_EVENT_ERROR | BEV_EVENT_EOF | BEV_EVENT_READING | BEV_EVENT_WRITING)) {
     LOG_INFO("eventcb: received error event cb:%x on fd:%d", what, fd);