Skip to content

Commit

Permalink
Merge pull request #1262 from fengzeroz/v2.4
Browse files Browse the repository at this point in the history
manager nng: set sendtimeout
  • Loading branch information
fengzeroz authored May 15, 2023
2 parents 6d6af8b + d2cd926 commit 163475f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/adapter/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ neu_adapter_t *neu_adapter_create(neu_adapter_info_t *info)

rv = nng_pair1_open(&adapter->sock);
assert(rv == 0);
nng_socket_set_int(adapter->sock, NNG_OPT_RECVBUF, 2048);
nng_socket_set_int(adapter->sock, NNG_OPT_SENDBUF, 2048);
nng_socket_set_int(adapter->sock, NNG_OPT_RECVBUF, 8192);
nng_socket_set_int(adapter->sock, NNG_OPT_SENDBUF, 8192);
nng_socket_set_ms(adapter->sock, NNG_OPT_SENDTIMEO, 1000);
nng_socket_get_int(adapter->sock, NNG_OPT_RECVFD, &adapter->recv_fd);

Expand Down
3 changes: 3 additions & 0 deletions src/core/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ neu_manager_t *neu_manager_create()

nng_socket_set_int(manager->socket, NNG_OPT_RECVBUF, 8192);
nng_socket_set_int(manager->socket, NNG_OPT_SENDBUF, 8292);
nng_socket_set_ms(manager->socket, NNG_OPT_SENDTIMEO, 1000);
nng_socket_get_int(manager->socket, NNG_OPT_RECVFD, &param.fd);
manager->loop = neu_event_add_io(manager->events, param);

Expand Down Expand Up @@ -731,6 +732,7 @@ inline static void forward_msg_dup(neu_manager_t *manager, nng_msg *msg,
if (nng_sendmsg(manager->socket, out_msg, 0) == 0) {
nlog_debug("forward msg to pipe %d", pipe.id);
} else {
nlog_warn("forward msg to pipe %d fail", pipe.id);
nng_msg_free(out_msg);
}
}
Expand All @@ -746,6 +748,7 @@ inline static void forward_msg(neu_manager_t *manager, nng_msg *msg,
if (nng_sendmsg(manager->socket, out_msg, 0) == 0) {
nlog_debug("forward msg to %s", node);
} else {
nlog_warn("forward msg to pipe (%s)%d fail", node, pipe.id);
nng_msg_free(out_msg);
}
}
Expand Down

0 comments on commit 163475f

Please sign in to comment.