diff options
author | Runxi Yu <me@runxiyu.org> | 2024-12-08 10:40:08 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-12-08 10:40:08 +0800 |
commit | 087905492601a55ff53541ef469526051c30aa0b (patch) | |
tree | a7d05fd8fa737b82e40c3ea4a91a41b0b3c35a45 /main.go | |
parent | Registration (diff) | |
download | meseircd-087905492601a55ff53541ef469526051c30aa0b.tar.gz meseircd-087905492601a55ff53541ef469526051c30aa0b.tar.zst meseircd-087905492601a55ff53541ef469526051c30aa0b.zip |
Proper UID handling
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -30,26 +30,23 @@ func main() { log.Fatal(err) } - client := &Client{ - conn: &conn, - Server: self, - State: ClientStatePreRegistration, - UID: "blah", - Nick: "*", - } - // TODO: Add to the UID table and make actually unique UIDs go func() { defer func() { - client.Teardown() - (*client.conn).Close() - // TODO: Unified client clean-up - }() - defer func() { raised := recover() if raised != nil { slog.Error("connection routine panicked", "raised", raised) } }() + defer func() { + conn.Close() + }() + client, err := NewLocalClient(&conn) + if err != nil { + slog.Error("cannot make new local client", "error", err) + } + defer func() { + client.Teardown() + }() client.handleConnection() }() } |