summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-04-10 11:17:54 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-04-10 11:17:54 -0700
commitb117ff54358d4e2b6b8eae4bd5300464f377d948 (patch)
tree3329edee4e08e39e8cfa4c4d4f8cf6aa1b349ffb /main.cpp
parent119ef5ecbf5653ddf497666e18894fa148cc2e9b (diff)
downloadinfinitytier-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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 5011b562..6e9bf5db 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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__