aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-08 08:55:37 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-08 08:55:37 +0800
commitad6adae43dd0069889c1b64c21350114b783a055 (patch)
tree65e1464fa3eb30ef1ed6b8016f10f5b0066aa62a /main.go
parentServer and self awareness (diff)
downloadmeseircd-ad6adae43dd0069889c1b64c21350114b783a055.tar.gz
meseircd-ad6adae43dd0069889c1b64c21350114b783a055.tar.zst
meseircd-ad6adae43dd0069889c1b64c21350114b783a055.zip
Make Client.conn optional
Diffstat (limited to '')
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
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)