aboutsummaryrefslogtreecommitdiff
path: root/sshnodelay.c
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2017-06-06 10:57:09 -0400
committerNikolaus Rath <Nikolaus@rath.org>2017-06-06 11:01:21 -0400
commit132dd88755a115e2c44cea1a8c68009e59b994a3 (patch)
tree76e463c8d579c6ccd118bad2be70f6acfe7dee72 /sshnodelay.c
parentaf1f3c6235833ae2500eb886c612a142fd82017c (diff)
downloadsshfs-132dd88755a115e2c44cea1a8c68009e59b994a3.tar
sshfs-132dd88755a115e2c44cea1a8c68009e59b994a3.tar.gz
sshfs-132dd88755a115e2c44cea1a8c68009e59b994a3.tar.bz2
sshfs-132dd88755a115e2c44cea1a8c68009e59b994a3.zip
Dropped nodelay workaround
This was a performance improvement for SSH versions prior to 4.4. There is no reason to continue to support this.
Diffstat (limited to 'sshnodelay.c')
-rw-r--r--sshnodelay.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/sshnodelay.c b/sshnodelay.c
deleted file mode 100644
index a9f307c..0000000
--- a/sshnodelay.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#define _GNU_SOURCE
-#include <dlfcn.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-
-/* Wrapper around connect(2) to explicitly set TCP_NODELAY. */
-static int nodelay_connect(
- int (*real_connect)(int, const struct sockaddr *, socklen_t),
- int sock, const struct sockaddr *addr, socklen_t addrlen)
-{
- int res = real_connect(sock, addr, addrlen);
- if (!res && addr->sa_family == AF_INET) {
- int opt = 1;
- setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
- }
- return res;
-}
-
-#if __APPLE__
-
-/* OS X does not have LD_PRELOAD but has DYLD_INSERT_LIBRARIES. The right
- * environment variable is set by sshfs.c when attempting to load the
- * sshnodelay workaround.
- *
- * However, things are not that simple: DYLD_INSERT_LIBRARIES does not
- * behave exactly like LD_PRELOAD. Instead, the dyld dynamic linker will
- * look for __DATA __interpose sections on the libraries given via the
- * DYLD_INSERT_LIBRARIES variable. The contents of this section are pairs
- * of replacement functions and functions to be replaced, respectively.
- * Prepare such section here. */
-
-int custom_connect(int sock, const struct sockaddr *addr, socklen_t addrlen);
-
-typedef struct interpose_s {
- void *new_func;
- void *orig_func;
-} interpose_t;
-
-static const interpose_t interposers[] \
- __attribute__ ((section("__DATA, __interpose"))) = {
- { (void *)custom_connect, (void *)connect },
-};
-
-int custom_connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
-{
- return nodelay_connect(connect, sock, addr, addrlen);
-}
-
-#else /* !__APPLE__ */
-
-int connect(int sock, const struct sockaddr *addr, socklen_t addrlen)
-{
- return nodelay_connect(dlsym(RTLD_NEXT, "connect"),
- sock, addr, addrlen);
-}
-
-#endif /* !__APPLE__ */