diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-04-10 11:17:54 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-04-10 11:17:54 -0700 |
commit | b117ff54358d4e2b6b8eae4bd5300464f377d948 (patch) | |
tree | 3329edee4e08e39e8cfa4c4d4f8cf6aa1b349ffb /main.cpp | |
parent | 119ef5ecbf5653ddf497666e18894fa148cc2e9b (diff) | |
download | infinitytier-b117ff54358d4e2b6b8eae4bd5300464f377d948.tar.gz infinitytier-b117ff54358d4e2b6b8eae4bd5300464f377d948.zip |
Probable fix for GitHub issue #63 - do not unite() if either path is TCP, since doing so can result in asymmetric failed NAT-t over UDP if one side has a firewall that permits outgoing UDP but not incoming.
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -462,6 +462,17 @@ int main(int argc,char **argv) signal(SIGINT,&sighandlerQuit); signal(SIGTERM,&sighandlerQuit); signal(SIGQUIT,&sighandlerQuit); + + /* Ensure that there are no inherited file descriptors open from a previous + * incarnation. This is a hack to ensure that GitHub issue #61 or variants + * of it do not return, and should not do anything otherwise bad. */ + { + int mfd = STDIN_FILENO; + if (STDOUT_FILENO > mfd) mfd = STDOUT_FILENO; + if (STDERR_FILENO > mfd) mfd = STDERR_FILENO; + for(int f=mfd+1;f<1024;++f) + ::close(f); + } #endif #ifdef __WINDOWS__ |