Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

缓冲区大小cmake定义, 增加Err_reset错误 #196

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

alexliyu7352
Copy link
Member

The default buffer size of a socket should not be hardcoded in the program; it should be configurable. Additionally, in Linux, adjusting kernel parameters can be more effective in improving the performance or throughput of a program in scenarios such as high-latency "long fat networks" or high-concurrency situations, compared to using setsockopt.

  1. 可以在cmake中定义默认缓冲区大小, 当为0时内核调解缓冲区大小.
  2. 捕捉UV_ECONNRESET错误, zlm的httpclient默认使用持久化链接, 部分服务器有通过webserver或者firewall设置了连接空闲时间时会触发UV_ECONNRESET.

…ogram; it should be configurable. Additionally, in Linux, adjusting kernel parameters can be more effective in improving the performance or throughput of a program in scenarios such as high-latency "long fat networks" or high-concurrency situations, compared to using setsockopt.
src/Network/sockutil.h Outdated Show resolved Hide resolved
@xia-chu
Copy link
Member

xia-chu commented Nov 29, 2023

感觉你的改法有点绕啊,有没有必要改成这样:

#if !defined(SOCKET_DEFAULT_BUF_SIZE)
#define SOCKET_DEFAULT_BUF_SIZE 256 * 1024
#endif
if(DEFINED SOCKET_DEFAULT_BUF_SIZE)
    add_definitions(-DSOCKET_DEFAULT_BUF_SIZE=${SOCKET_DEFAULT_BUF_SIZE})
endif()

就是在cmake中不指定宏 就默认设置下。

@alexliyu7352
Copy link
Member Author

感觉你的改法有点绕啊,有没有必要改成这样:

#if !defined(SOCKET_DEFAULT_BUF_SIZE)
#define SOCKET_DEFAULT_BUF_SIZE 256 * 1024
#endif
if(DEFINED SOCKET_DEFAULT_BUF_SIZE)
    add_definitions(-DSOCKET_DEFAULT_BUF_SIZE=${SOCKET_DEFAULT_BUF_SIZE})
endif()

就是在cmake中不指定宏 就默认设置下。

的确哦, 这是很早之前的, 我是从之前项目直接复制过来了, 抱歉哈...
我改改

src/Network/sockutil.cpp Outdated Show resolved Hide resolved
src/Network/sockutil.cpp Outdated Show resolved Hide resolved
@xia-chu xia-chu merged commit 63d8521 into ZLMediaKit:master Dec 1, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants