mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-11 00:20:54 +00:00
Reformat
This commit is contained in:
parent
85a0fb7b79
commit
ea4909cdc6
2 changed files with 5 additions and 7 deletions
|
@ -463,7 +463,7 @@ func runSocketReader(conn *websocket.Conn, client *ClientInfo, errorChan chan<-
|
||||||
}
|
}
|
||||||
|
|
||||||
func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan error, clientChan <-chan ClientMessage, serverMessageChan <-chan ClientMessage) websocket.CloseError {
|
func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan error, clientChan <-chan ClientMessage, serverMessageChan <-chan ClientMessage) websocket.CloseError {
|
||||||
pingTicker := time.NewTicker(1*time.Minute)
|
pingTicker := time.NewTicker(1 * time.Minute)
|
||||||
defer pingTicker.Stop()
|
defer pingTicker.Stop()
|
||||||
lastPacket := time.Now()
|
lastPacket := time.Now()
|
||||||
|
|
||||||
|
@ -512,9 +512,9 @@ func runSocketWriter(conn *websocket.Conn, client *ClientInfo, errorChan <-chan
|
||||||
|
|
||||||
case <-pingTicker.C:
|
case <-pingTicker.C:
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
if lastPacket.Add(5*time.Minute).Before(now) {
|
if lastPacket.Add(5 * time.Minute).Before(now) {
|
||||||
return CloseTimedOut
|
return CloseTimedOut
|
||||||
} else if lastPacket.Add(1*time.Minute).Before(now) {
|
} else if lastPacket.Add(1 * time.Minute).Before(now) {
|
||||||
conn.WriteControl(websocket.PingMessage, []byte(strconv.FormatInt(time.Now().Unix(), 10)), getDeadline())
|
conn.WriteControl(websocket.PingMessage, []byte(strconv.FormatInt(time.Now().Unix(), 10)), getDeadline())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,11 @@ type ConfigFile struct {
|
||||||
ProxyRoutes []ProxyRoute
|
ProxyRoutes []ProxyRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type ProxyRoute struct {
|
type ProxyRoute struct {
|
||||||
Route string
|
Route string
|
||||||
Server string
|
Server string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type ClientMessage struct {
|
type ClientMessage struct {
|
||||||
// Message ID. Increments by 1 for each message sent from the client.
|
// Message ID. Increments by 1 for each message sent from the client.
|
||||||
// When replying to a command, the message ID must be echoed.
|
// When replying to a command, the message ID must be echoed.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue