mirror of
https://github.com/lwch/natpass
synced 2025-10-27 22:11:27 +08:00
19 lines
310 B
Go
19 lines
310 B
Go
package conn
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/lwch/natpass/code/network"
|
|
)
|
|
|
|
// SendKeepalive send keepalive message
|
|
func (conn *Conn) SendKeepalive() {
|
|
var msg network.Msg
|
|
msg.To = "server"
|
|
msg.XType = network.Msg_keepalive
|
|
select {
|
|
case conn.write <- &msg:
|
|
case <-time.After(conn.cfg.WriteTimeout):
|
|
}
|
|
}
|