github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/cmn/network_unix.go (about) 1 // Package cmn provides common constants, types, and utilities for AIS clients 2 // and AIStore. 3 /* 4 * Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved. 5 */ 6 package cmn 7 8 import ( 9 "syscall" 10 11 "github.com/NVIDIA/aistore/cmn/debug" 12 ) 13 14 func (args *TransportArgs) setSockOpt(_, _ string, c syscall.RawConn) (err error) { 15 return c.Control(args.ConnControl(c)) 16 } 17 18 func (args *TransportArgs) ConnControl(_ syscall.RawConn) (cntl func(fd uintptr)) { 19 cntl = func(fd uintptr) { 20 // NOTE: is limited by /proc/sys/net/core/rmem_max 21 err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF, args.SndRcvBufSize) 22 debug.AssertNoErr(err) 23 // NOTE: is limited by /proc/sys/net/core/wmem_max 24 err = syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_SNDBUF, args.SndRcvBufSize) 25 debug.AssertNoErr(err) 26 } 27 return 28 }