mirror of
https://github.com/fluffle/goirc
synced 2025-05-12 10:41:42 +00:00
Put read lock in Connected() (10->9).
This commit is contained in:
parent
648864c1d4
commit
637cdb573f
2 changed files with 4 additions and 2 deletions
|
@ -16,7 +16,7 @@ import (
|
|||
// An IRC connection is represented by this struct.
|
||||
type Conn struct {
|
||||
// For preventing races on (dis)connect.
|
||||
mu sync.Mutex
|
||||
mu sync.RWMutex
|
||||
|
||||
// Contains parameters that people can tweak to change client behaviour.
|
||||
cfg *Config
|
||||
|
@ -134,6 +134,8 @@ func Client(cfg *Config) *Conn {
|
|||
}
|
||||
|
||||
func (conn *Conn) Connected() bool {
|
||||
conn.mu.RLock()
|
||||
defer conn.mu.RUnlock()
|
||||
return conn.connected
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue