提交 91a52683 编写于 作者: O obdev 提交者: ob-robot

observer should exit if listen rpc port failed

上级 852fc2c5
......@@ -152,12 +152,13 @@ int ObPocRpcServer::start(int port, int net_thread_count, frame::ObReqDeliver* d
int lfd = -1;
int grp = 1;
if ((lfd = pn_listen(port, serve_cb)) == -1) {
ret = OB_IO_ERROR;
ret = OB_SERVER_LISTEN_ERROR;
RPC_LOG(ERROR, "pn_listen failed", K(ret));
} else {
global_deliver = deliver;
int count = pn_provision(lfd, grp, net_thread_count);
if (count != net_thread_count) {
ret = OB_ERR_SYS;
RPC_LOG(WARN, "pn_provision error", K(count), K(net_thread_count));
}
has_start_ = true;
......
......@@ -82,7 +82,7 @@ PN_API int pn_listen(int port, serve_cb_t cb)
pn_listen_t* pnl = locate_listen(idx);
addr_t addr;
addr_init(&addr, "0.0.0.0", port);
if (listen_init(&pnl->l, addr, pnl_dispatch_accept) < 0) {
if (listen_init(&pnl->l, addr, pnl_dispatch_accept) != 0) {
idx = -1;
} else {
pnl->serve_cb = cb;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册