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

set tcp keepalive for tcp socket #1045

Merged
merged 1 commit into from
Jan 7, 2018
Merged

Conversation

juntaoliu
Copy link
Contributor

No description provided.

@winlinvip
Copy link
Member

winlinvip commented Jan 7, 2018

Fix #1044 Issue of abnormal disconnection of TCP connection in live streaming pull flow end cannot be released.

TRANS_BY_GPT3

@winlinvip winlinvip merged commit a687105 into ossrs:2.0release Jan 7, 2018
@@ -223,6 +223,16 @@ int SrsTcpListener::listen()
}
srs_verbose("setsockopt reuse-addr success. port=%d, fd=%d", port, _fd);

#ifdef SO_KEEPALIVE
Copy link
Member

@winlinvip winlinvip Jan 7, 2018

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

Copy link
Member

@winlinvip winlinvip Jan 7, 2018

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

Copy link
Contributor Author

@juntaoliu juntaoliu Jan 8, 2018

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

winlinvip added a commit that referenced this pull request Jan 7, 2018
@juntaoliu juntaoliu deleted the 2.0release branch January 8, 2018 02:39
@juntaoliu juntaoliu restored the 2.0release branch January 8, 2018 02:40
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants