mirror of
https://github.com/matrix-org/pinecone.git
synced 2026-10-24 11:59:18 +03:00
Tweaks to TCP timeouts in pineconeip
This commit is contained in:
@@ -15,12 +15,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/ed25519"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
@@ -36,6 +38,14 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
dialer := net.Dialer{
|
||||
Timeout: time.Second * 5,
|
||||
KeepAlive: time.Second * 3,
|
||||
}
|
||||
listener := net.ListenConfig{
|
||||
KeepAlive: time.Second * 3,
|
||||
}
|
||||
|
||||
logger := log.New(os.Stdout, "", 0)
|
||||
if hostPort := os.Getenv("PPROFLISTEN"); hostPort != "" {
|
||||
logger.Println("Starting pprof on", hostPort)
|
||||
@@ -59,7 +69,7 @@ func main() {
|
||||
|
||||
if connect != nil && *connect != "" {
|
||||
go func() {
|
||||
conn, err := net.Dial("tcp", *connect)
|
||||
conn, err := dialer.Dial("tcp", *connect)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -74,7 +84,7 @@ func main() {
|
||||
}
|
||||
|
||||
go func() {
|
||||
listener, err := net.Listen("tcp", *listen)
|
||||
listener, err := listener.Listen(context.Background(), "tcp", *listen)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user