mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
don't double-close socket
This commit is contained in:
parent
4d9742d033
commit
3a9027e3dc
@ -19,17 +19,15 @@ type Client struct {
|
||||
idleTimer *time.Timer
|
||||
invisible bool
|
||||
loginTimer *time.Timer
|
||||
mutex *sync.Mutex
|
||||
nick string
|
||||
operator bool
|
||||
phase Phase
|
||||
quitTimer *time.Timer
|
||||
realname string
|
||||
registered bool
|
||||
replies chan Reply
|
||||
server *Server
|
||||
socket *Socket
|
||||
mutex *sync.Mutex
|
||||
authorized bool
|
||||
username string
|
||||
}
|
||||
|
||||
@ -119,7 +117,7 @@ func (c *Client) readCommands() {
|
||||
c.server.Command(m)
|
||||
}
|
||||
|
||||
if c.registered {
|
||||
if c.phase == Normal {
|
||||
c.ConnectionClosed()
|
||||
} else {
|
||||
c.Destroy()
|
||||
|
@ -169,7 +169,6 @@ func (s *Server) GenerateGuestNick() string {
|
||||
|
||||
func (s *Server) tryRegister(c *Client) {
|
||||
if c.HasNick() && c.HasUsername() {
|
||||
c.registered = true
|
||||
c.phase = Normal
|
||||
c.loginTimer.Stop()
|
||||
c.Reply(
|
||||
@ -250,7 +249,6 @@ func (m *PassCommand) HandleAuthServer(s *Server) {
|
||||
return
|
||||
}
|
||||
|
||||
client.authorized = true
|
||||
client.phase = Registration
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,6 @@ func (socket *Socket) writeLines() {
|
||||
break
|
||||
}
|
||||
}
|
||||
socket.Close()
|
||||
}
|
||||
|
||||
func (socket *Socket) maybeLogWriteError(err error) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user