Browse Source

client: Use more accurate QUIT message for ping timeouts

tags/v0.1.0
Daniel Oaks 8 years ago
parent
commit
5d3b185881
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      irc/client.go

+ 8
- 3
irc/client.go View File

8
 import (
8
 import (
9
 	"fmt"
9
 	"fmt"
10
 	"net"
10
 	"net"
11
+	"strconv"
11
 	"time"
12
 	"time"
12
 
13
 
13
 	"github.com/DanielOaks/girc-go/ircmsg"
14
 	"github.com/DanielOaks/girc-go/ircmsg"
14
 )
15
 )
15
 
16
 
16
 const (
17
 const (
17
-	IDLE_TIMEOUT = time.Minute // how long before a client is considered idle
18
-	QUIT_TIMEOUT = time.Minute // how long after idle before a client is kicked
18
+	IDLE_TIMEOUT = time.Minute + time.Second*30 // how long before a client is considered idle
19
+	QUIT_TIMEOUT = time.Minute                  // how long after idle before a client is kicked
20
+)
21
+
22
+var (
23
+	TIMEOUT_STATED_SECONDS = strconv.Itoa(int((IDLE_TIMEOUT + QUIT_TIMEOUT).Seconds()))
19
 )
24
 )
20
 
25
 
21
 type Client struct {
26
 type Client struct {
117
 //
122
 //
118
 
123
 
119
 func (client *Client) connectionTimeout() {
124
 func (client *Client) connectionTimeout() {
120
-	client.Quit("connection timeout")
125
+	client.Quit(fmt.Sprintf("Ping timeout: %s seconds", TIMEOUT_STATED_SECONDS))
121
 	client.isQuitting = true
126
 	client.isQuitting = true
122
 }
127
 }
123
 
128
 

Loading…
Cancel
Save