aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clients.go6
-rw-r--r--main.go8
2 files changed, 7 insertions, 7 deletions
diff --git a/clients.go b/clients.go
index e1b80a6..d142157 100644
--- a/clients.go
+++ b/clients.go
@@ -5,7 +5,7 @@ import (
)
type Client struct {
- conn net.Conn
+ conn *net.Conn
UID [6]byte
Nick string
Ident string
@@ -20,11 +20,11 @@ func (client *Client) Send(msg SMsg) {
// Send failures are not returned; broken connections detected and severed on
// the next receive.
func (client *Client) SendRaw(s string) {
- _, err := client.conn.Write([]byte(s))
+ _, err := (*client.conn).Write([]byte(s))
if err != nil {
// TODO: Should shut down the netFd instead but the stdlib
// doesn't expose a way to do this.
- client.conn.Close()
+ (*client.conn).Close()
}
}
diff --git a/main.go b/main.go
index f7e0f2d..34d132e 100644
--- a/main.go
+++ b/main.go
@@ -27,12 +27,12 @@ func main() {
}
client := &Client{
- conn: conn,
+ conn: &conn,
Server: self,
}
go func() {
defer func() {
- client.conn.Close()
+ (*client.conn).Close()
// TODO: Unified client clean-up
}()
defer func() {
@@ -47,13 +47,13 @@ func main() {
}
func (client *Client) handleConnection() {
- reader := bufio.NewReader(client.conn)
+ reader := bufio.NewReader(*client.conn)
messageLoop:
for {
line, err := reader.ReadString('\n')
if err != nil {
slog.Error("error while reading from connection", "error", err)
- client.conn.Close()
+ (*client.conn).Close()
return
}
msg, err := parseIRCMsg(line)