Skip to content

Commit 511be4f

Browse files
committed
session: add 2 min mailbox ping
Ensure that the mailbox grpc connection sends a ping every 2 mins to ensure that the connection remains open.
1 parent 954daad commit 511be4f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

session/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import (
44
"crypto/tls"
55
"fmt"
66
"sync"
7+
"time"
78

89
"github.com/btcsuite/btcd/btcec"
910
"github.com/lightninglabs/lightning-node-connect/mailbox"
1011
"github.com/lightningnetwork/lnd/keychain"
1112
"google.golang.org/grpc"
1213
"google.golang.org/grpc/credentials"
14+
"google.golang.org/grpc/keepalive"
1315
)
1416

1517
type sessionID [33]byte
@@ -41,6 +43,9 @@ func (m *mailboxSession) start(session *Session,
4143
mailboxServer, err := mailbox.NewServer(
4244
session.ServerAddr, session.PairingSecret[:],
4345
grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)),
46+
grpc.WithKeepaliveParams(keepalive.ClientParameters{
47+
Time: 2 * time.Minute,
48+
}),
4449
)
4550
if err != nil {
4651
return err

0 commit comments

Comments
 (0)