[CP] fix arb server not support rpc authention
This commit is contained in:
parent
cfd2e2edc0
commit
0a6087b41b
@ -30,7 +30,8 @@ namespace obrpc
|
||||
extern const int easy_head_size;
|
||||
ObPocRpcServer global_poc_server;
|
||||
ObListener* global_ob_listener;
|
||||
bool __attribute__((weak)) enable_pkt_nio() {
|
||||
bool __attribute__((weak)) enable_pkt_nio(bool start_as_client) {
|
||||
UNUSED(start_as_client);
|
||||
return false;
|
||||
}
|
||||
int64_t __attribute__((weak)) get_max_rpc_packet_size() {
|
||||
@ -270,6 +271,7 @@ int ObPocRpcServer::start_net_client(int net_thread_count)
|
||||
RPC_LOG(WARN, "pn_provision for RATELIMIT_PNIO_GROUP error", K(count), K(net_thread_count));
|
||||
} else {
|
||||
has_start_ = true;
|
||||
start_as_client_ = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -316,7 +318,7 @@ uint64_t ObPocRpcServer::get_ratelimit_rxbytes() {
|
||||
return pn_get_rxbytes(RATELIMIT_PNIO_GROUP);
|
||||
}
|
||||
bool ObPocRpcServer::client_use_pkt_nio() {
|
||||
return has_start() && enable_pkt_nio();
|
||||
return has_start() && enable_pkt_nio(start_as_client_);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
3
deps/oblib/src/rpc/obrpc/ob_poc_rpc_server.h
vendored
3
deps/oblib/src/rpc/obrpc/ob_poc_rpc_server.h
vendored
@ -60,7 +60,7 @@ public:
|
||||
RATELIMIT_PNIO_GROUP = 2,
|
||||
END_GROUP
|
||||
};
|
||||
ObPocRpcServer() : has_start_(false){}
|
||||
ObPocRpcServer() : has_start_(false), start_as_client_(false){}
|
||||
~ObPocRpcServer() {}
|
||||
int start(int port, int net_thread_count, rpc::frame::ObReqDeliver* deliver);
|
||||
int start_net_client(int net_thread_count);
|
||||
@ -74,6 +74,7 @@ public:
|
||||
uint64_t get_ratelimit_rxbytes();
|
||||
private:
|
||||
bool has_start_;
|
||||
bool start_as_client_;
|
||||
};
|
||||
|
||||
extern ObPocRpcServer global_poc_server;
|
||||
|
29
deps/oblib/src/rpc/pnio/nio/inet.c
vendored
29
deps/oblib/src/rpc/pnio/nio/inet.c
vendored
@ -51,18 +51,27 @@ int async_connect(addr_t dest, uint64_t dispatch_id) {
|
||||
}
|
||||
|
||||
int listen_create(addr_t src) {
|
||||
int fd = 0;
|
||||
int fd = -1;
|
||||
int err = 0;
|
||||
struct sockaddr_in sin;
|
||||
ef((fd = socket(AF_INET, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0)) < 0);
|
||||
ef(set_tcp_reuse_addr(fd));
|
||||
ef(bind(fd, (const struct sockaddr*)make_sockaddr(&sin, src), sizeof(sin)));
|
||||
ef(ussl_listen(fd, 1024));
|
||||
return fd;
|
||||
el();
|
||||
if (fd >= 0) {
|
||||
ussl_close(fd);
|
||||
if ((fd = socket(AF_INET, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0)) < 0) {
|
||||
rk_warn("create socket failed, src=%s, errno=%d", T2S(addr, src), errno);
|
||||
err = PNIO_LISTEN_ERROR;
|
||||
} else if (set_tcp_reuse_addr(fd) != 0) {
|
||||
err = PNIO_LISTEN_ERROR;
|
||||
rk_warn("reuse_addr failed, src=%s, fd=%d, errno=%d", T2S(addr, src), fd, errno);
|
||||
} else if (bind(fd, (const struct sockaddr*)make_sockaddr(&sin, src), sizeof(sin)) != 0) {
|
||||
err = PNIO_LISTEN_ERROR;
|
||||
rk_warn("bind failed, src=%s, fd=%d, errno=%d", T2S(addr, src), fd, errno);
|
||||
} else if (ussl_listen(fd, 1024) != 0) {
|
||||
err = PNIO_LISTEN_ERROR;
|
||||
rk_warn("listen failed, src=%s, fd=%d, errno=%d", T2S(addr, src), fd, errno);
|
||||
}
|
||||
return -1;
|
||||
if (err != 0 && fd >= 0) {
|
||||
ussl_close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
int tcp_accept(int fd) {
|
||||
|
@ -132,7 +132,7 @@ int ObServerReloadConfig::operator()()
|
||||
real_ret = ret;
|
||||
LOG_WARN("reload config for tde encrypt engine fail", K(ret));
|
||||
}
|
||||
if (OB_FAIL(OBSERVER.get_net_frame().reload_rpc_auth_method())) {
|
||||
if (OB_FAIL(ObSrvNetworkFrame::reload_rpc_auth_method())) {
|
||||
real_ret = ret;
|
||||
LOG_WARN("reload config for rpc auth method fail", K(ret));
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
int cnt = deliver_.get_mysql_login_thread_count_to_set(static_cast<int32_t>(GCONF.sql_login_thread_count));
|
||||
return deliver_.set_mysql_login_thread_count(cnt);
|
||||
}
|
||||
int reload_rpc_auth_method();
|
||||
static int reload_rpc_auth_method();
|
||||
|
||||
rootserver::ObIngressBWAllocService *get_ingress_service();
|
||||
int net_endpoint_register(const ObNetEndpointKey &endpoint_key, int64_t expire_time);
|
||||
|
@ -545,9 +545,9 @@ OB_DEF_SERIALIZE_SIZE(ObServerConfig)
|
||||
|
||||
} // end of namespace common
|
||||
namespace obrpc {
|
||||
bool enable_pkt_nio() {
|
||||
bool enable_pkt_nio(bool start_as_client) {
|
||||
bool bool_ret = false;
|
||||
if (OB_UNLIKELY(OBSERVER.is_stopped() || OBSERVER.is_arbitration_mode())) {
|
||||
if (OB_UNLIKELY(start_as_client || OBSERVER.is_arbitration_mode())) {
|
||||
bool enable_client_auth = (get_client_auth_methods() != USSL_AUTH_NONE);
|
||||
bool_ret = GCONF._enable_pkt_nio && enable_client_auth;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user