-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
set tcp keepalive for tcp socket #1045
Conversation
Fix #1044 Issue of abnormal disconnection of TCP connection in live streaming pull flow end cannot be released.
|
@@ -223,6 +223,16 @@ int SrsTcpListener::listen() | |||
} | |||
srs_verbose("setsockopt reuse-addr success. port=%d, fd=%d", port, _fd); | |||
|
|||
#ifdef SO_KEEPALIVE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use macro definition to enable this setting? Why not always set SO_KEEPALIVE?
This macro should be undefined, so this code will not take effect, right?
TRANS_BY_GPT3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This macro is system-defined and is a reasonable way to write it.
TRANS_BY_GPT3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not set to open using macros, but to enhance the portability of the code. Most Unix-like systems generally define SO_KEEPALIVE in the system, so there is no problem with or without this macro judgment in such systems. However, if the code is ported to other systems, those systems may not support SO_KEEPALIVE.
TRANS_BY_GPT3
No description provided.