forked from External/ergo
fix #1225
This commit is contained in:
parent
8f490ae298
commit
06882a9b89
5 changed files with 22 additions and 24 deletions
|
|
@ -235,20 +235,15 @@ func (client *Client) Oper() *Oper {
|
|||
return client.oper
|
||||
}
|
||||
|
||||
func (client *Client) Registered() bool {
|
||||
client.stateMutex.RLock()
|
||||
defer client.stateMutex.RUnlock()
|
||||
return client.registered
|
||||
}
|
||||
|
||||
func (client *Client) SetRegistered() {
|
||||
func (client *Client) Registered() (result bool) {
|
||||
// `registered` is only written from the client's own goroutine, but may be
|
||||
// read from other goroutines; therefore, the client's own goroutine may read
|
||||
// the value without synchronization, but must write it with synchronization,
|
||||
// and other goroutines must read it with synchronization
|
||||
client.stateMutex.Lock()
|
||||
client.registered = true
|
||||
client.stateMutex.Unlock()
|
||||
client.stateMutex.RLock()
|
||||
result = client.registered
|
||||
client.stateMutex.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) RawHostname() (result string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue