Skip to content

Commit 1d312ca

Browse files
authored
[chore](thrift)thrift warn when socket is nullptr (#58599)
1 parent aa0e8d4 commit 1d312ca

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

be/src/util/thrift_client.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,31 @@ class ThriftClientImpl {
6262
void close();
6363

6464
// Set the connect timeout
65-
void set_conn_timeout(int ms) { _socket->setConnTimeout(ms); }
65+
void set_conn_timeout(int ms) {
66+
if (!_socket) {
67+
LOG(WARNING) << "socket is nullptr";
68+
return;
69+
}
70+
_socket->setConnTimeout(ms);
71+
}
6672

6773
// Set the receive timeout
68-
void set_recv_timeout(int ms) { _socket->setRecvTimeout(ms); }
74+
void set_recv_timeout(int ms) {
75+
if (!_socket) {
76+
LOG(WARNING) << "socket is nullptr";
77+
return;
78+
}
79+
_socket->setRecvTimeout(ms);
80+
}
6981

7082
// Set the send timeout
71-
void set_send_timeout(int ms) { _socket->setSendTimeout(ms); }
83+
void set_send_timeout(int ms) {
84+
if (!_socket) {
85+
LOG(WARNING) << "socket is nullptr";
86+
return;
87+
}
88+
_socket->setSendTimeout(ms);
89+
}
7290

7391
protected:
7492
ThriftClientImpl(const std::string& ipaddress, int port)

0 commit comments

Comments
 (0)