Allow transports to define their own ping mechanism

This commit is contained in:
Wichert Akkerman
2019-10-15 20:56:11 +02:00
committed by Mickaël Rémond
parent d0f2b492ac
commit 36e153f981
4 changed files with 25 additions and 2 deletions
+2 -2
View File
@@ -276,8 +276,8 @@ func keepalive(transport Transport, quit <-chan struct{}) {
for {
select {
case <-ticker.C:
if n, err := fmt.Fprintf(transport, "\n"); err != nil || n != 1 {
// When keep alive fails, we force close the transportection. In all cases, the recv will also fail.
if err := transport.Ping(); err != nil {
// When keepalive fails, we force close the transport. In all cases, the recv will also fail.
ticker.Stop()
_ = transport.Close()
return