about summary refs log tree commit diff stats
path: root/worker
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-12-11 20:53:10 +0100
committerRobin Jarry <robin@jarry.cc>2021-12-11 21:45:51 +0100
commit15a4cc7d0a84870ba04307154f394f9bdc98fd31 (patch)
tree47840744eafdf50a7fc1b1402e6ffaf078c4433a /worker
parent175d0efeb22eb61ce40a1b25969886a66fcdf83e (diff)
downloadaerc-15a4cc7d0a84870ba04307154f394f9bdc98fd31.tar.gz
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 <robin@jarry.cc>
Diffstat (limited to 'worker')
-rw-r--r--worker/imap/worker.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index 239b1cc..0f1c38d 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -7,7 +7,6 @@ import (
 	"net/url"
 	"strconv"
 	"strings"
-	"syscall"
 	"time"
 
 	"github.com/emersion/go-imap"
@@ -364,17 +363,13 @@ func (w *IMAPWorker) setKeepaliveParameters(conn *net.TCPConn) error {
 	err = rawConn.Control(func(fdPtr uintptr) {
 		fd := int(fdPtr)
 		// Max number of probes before failure
-		err := syscall.SetsockoptInt(
-			fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPCNT,
-			w.config.keepalive_probes)
+		err := lib.SetTcpKeepaliveProbes(fd, w.config.keepalive_probes)
 		if err != nil {
 			w.worker.Logger.Printf(
 				"cannot set tcp keepalive probes: %v\n", err)
 		}
 		// Wait time after an unsuccessful probe
-		err = syscall.SetsockoptInt(
-			fd, syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL,
-			w.config.keepalive_interval)
+		err = lib.SetTcpKeepaliveInterval(fd, w.config.keepalive_interval)
 		if err != nil {
 			w.worker.Logger.Printf(
 				"cannot set tcp keepalive interval: %v\n", err)