-
Notifications
You must be signed in to change notification settings - Fork 863
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
[apps] Fix broken TcpMedium of srt-tunnel in windows #935
Conversation
Deadlocks like that typically happen in case when a thread is expected to exit by itself, and that's why it's being joined, but by some reason it doesn't exit. Would you be able to run it with |
The structure is like this: The browser, the 2 tunnels and the proxy are running in the same machine. And these are log files: It's very easy to make it by visiting some foreign website in browser. I'm currently not very sure if the problem caused by my win32-porting or not. |
code is edited, and rebased to lastest master branch. |
apps/srt-tunnel.cpp
Outdated
@@ -478,6 +490,12 @@ class TcpMedium: public Medium | |||
// Just models. No options are predicted for now. | |||
void ConfigurePre(int ) | |||
{ | |||
int optval = 1; | |||
#if defined(LINUX) | |||
setsockopt(m_socket, SOL_SOCKET, MSG_NOSIGNAL, (const char*)&optval, sizeof(optval)); |
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.
MSG_NOSIGNAL
is not a flag settable by setsockopt
. It's a flag that should be passed in send
function in the last argument.
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.
https://stackoverflow.com/questions/26752649/so-nosigpipe-was-not-decleared
It is also recommended that if this is simply a standalone application (not a library), you can simply disable the SIGPIPE signal.
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.
Please fix the MSG_NOSIGNAL call
Done. According to How to prevent SIGPIPEs (or handle them properly), neither MSG_NOSIGNAL nor SO_NOSIGPIPE is portable. Another problem, I found cmake fail to generator nmakefile since commit CMake commandline is
It reports
In fact the file is located in After the changes, I have tried not to use |
Placing Not sure how to approach this change, but if you figure out how to make the build system work without this |
Slipped in PR #639 |
|
@sorayuki Please update the PR against master branch (conflicting changes). |
done |
close(fd)
,write(fd, ...)
andread(fd, ...)
are not suitable for socket operation in Windows.I have changed them to
closesocket
,send
andread
, while useread/write
for other platforms to prevent sigpipe signal.why use shutdown for tcp_close:
that is what
udpcommon
class in transmitmedia.cpp does.