From 15a4cc7d0a84870ba04307154f394f9bdc98fd31 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sat, 11 Dec 2021 20:53:10 +0100 Subject: imap: fix build on macos Fix the following build error on mac os: worker/imap/worker.go:368:29: undefined: syscall.TCP_KEEPCNT worker/imap/worker.go:376:29: undefined: syscall.TCP_KEEPINTVL These symbols are not defined on darwin. Fixes: 5dfeff75f368 ("imap: add tcp connection options") Signed-off-by: Robin Jarry --- lib/keepalive_dummy.go | 11 +++++++++++ lib/keepalive_linux.go | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 lib/keepalive_dummy.go create mode 100644 lib/keepalive_linux.go (limited to 'lib') diff --git a/lib/keepalive_dummy.go b/lib/keepalive_dummy.go new file mode 100644 index 00000000..205b577b --- /dev/null +++ b/lib/keepalive_dummy.go @@ -0,0 +1,11 @@ +//+build !linux + +package lib + +func SetTcpKeepaliveProbes(fd, count int) error { + return nil +} + +func SetTcpKeepaliveInterval(fd, interval int) error { + return nil +} diff --git a/lib/keepalive_linux.go b/lib/keepalive_linux.go new file mode 100644 index 00000000..0dc32850 --- /dev/null +++ b/lib/keepalive_linux.go @@ -0,0 +1,17 @@ +//+build linux + +package lib + +import ( + "syscall" +) + +func SetTcpKeepaliveProbes(fd, count int) error { + return syscall.SetsockoptInt( + fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPCNT, count) +} + +func SetTcpKeepaliveInterval(fd, interval int) error { + return syscall.SetsockoptInt( + fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, interval) +} -- cgit