From 60a3812ae73f8c95783ec3dc97d717464af1737b Mon Sep 17 00:00:00 2001 From: smallnest Date: Sat, 30 Nov 2024 11:07:29 +0800 Subject: [PATCH] set backlog --- go.mod | 2 +- go.sum | 4 ++++ server/listener_linux.go | 12 ++++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index acee149c..9f368d23 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/rs/cors v1.11.1 github.com/rubyist/circuitbreaker v2.2.1+incompatible github.com/smallnest/quick v0.2.0 - github.com/smallnest/rsocket v0.0.0-20241130014235-4fb25e79490f + github.com/smallnest/rsocket v0.0.0-20241130025819-fb14bead82dd github.com/soheilhy/cmux v0.1.5 github.com/stretchr/testify v1.9.0 github.com/tinylib/msgp v1.2.4 diff --git a/go.sum b/go.sum index 88f3e79a..130949bb 100644 --- a/go.sum +++ b/go.sum @@ -271,6 +271,10 @@ github.com/smallnest/quick v0.2.0 h1:AEvm7ZovZ6Utv+asFDBh866G4ufMNhRNMKbZHVMFYPE github.com/smallnest/quick v0.2.0/go.mod h1:ODNivpfZTaMgYrNb/fhDtqoEe2TTPxSRo8JaIT/QThI= github.com/smallnest/rsocket v0.0.0-20241130014235-4fb25e79490f h1:hazNcUBVc1e3FvEC1lvuKSeCdj/xqpKU6VLcGqbW7Dk= github.com/smallnest/rsocket v0.0.0-20241130014235-4fb25e79490f/go.mod h1:VJeIKKrDEzT4ZNVe87JN9uRLw1XLp/ZnnE9PfsyJ1jY= +github.com/smallnest/rsocket v0.0.0-20241130024725-6610e0bfbf73 h1:x08hpHpWfiLoa7usMDEFG+6qoGlpdg1njIha+ULVAgw= +github.com/smallnest/rsocket v0.0.0-20241130024725-6610e0bfbf73/go.mod h1:VJeIKKrDEzT4ZNVe87JN9uRLw1XLp/ZnnE9PfsyJ1jY= +github.com/smallnest/rsocket v0.0.0-20241130025819-fb14bead82dd h1:/uoOiwJ9g2MRmyZGdv+Yxvp/JY75YGRtoyUI78P7Jb8= +github.com/smallnest/rsocket v0.0.0-20241130025819-fb14bead82dd/go.mod h1:VJeIKKrDEzT4ZNVe87JN9uRLw1XLp/ZnnE9PfsyJ1jY= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/server/listener_linux.go b/server/listener_linux.go index 51c4feec..93535070 100644 --- a/server/listener_linux.go +++ b/server/listener_linux.go @@ -5,6 +5,7 @@ package server import ( "net" + "os" "runtime" "strconv" "time" @@ -77,6 +78,13 @@ func rdmaMakeListener(s *Server, address string) (ln net.Listener, err error) { if err != nil { return nil, err } - - return rsocket.NewTCPListener(host, p) + backlog := os.Getenv("RDMA_BACKLOG") + if backlog == "" { + backlog = "128" + } + blog, _ := strconv.Atoi(backlog) + if blog == 0 { + blog = 128 + } + return rsocket.NewTCPListener(host, p, blog) }