]> Cypherpunks.ru repositories - goircd.git/blobdiff - client.go
Fix several races
[goircd.git] / client.go
index 950cbcaba02100a28fb0b9f994a41e026548ad56..07a209b61d0a524653e56714bfa7fe81b10e4ebf 100644 (file)
--- a/client.go
+++ b/client.go
@@ -34,13 +34,16 @@ type Client struct {
        hostname   string
        conn       net.Conn
        registered bool
-       ping_sent  bool
-       timestamp  time.Time
        nickname   string
        username   string
        realname   string
 }
 
+type ClientAlivenessState struct {
+       ping_sent bool
+       timestamp time.Time
+}
+
 func (client Client) String() string {
        return client.nickname + "!" + client.username + "@" + client.conn.RemoteAddr().String()
 }
@@ -65,8 +68,6 @@ func (client *Client) Processor(sink chan<- ClientEvent) {
                        sink <- ClientEvent{client, EVENT_DEL, ""}
                        break
                }
-               client.timestamp = time.Now()
-               client.ping_sent = false
                buf_net = bytes.TrimRight(buf_net, "\x00")
                buf = append(buf, buf_net...)
                if !bytes.HasSuffix(buf, []byte(CRLF)) {