forked from cwtch.im/cwtch
Fix Race Condition
This commit is contained in:
parent
f5c397876b
commit
2abfaf82a1
|
@ -160,6 +160,8 @@ func (app *application) ListProfiles() []string {
|
||||||
|
|
||||||
// GetPeer returns a cwtchPeer for a given onion address
|
// GetPeer returns a cwtchPeer for a given onion address
|
||||||
func (app *application) GetPeer(onion string) peer.CwtchPeer {
|
func (app *application) GetPeer(onion string) peer.CwtchPeer {
|
||||||
|
app.appmutex.Lock()
|
||||||
|
defer app.appmutex.Unlock()
|
||||||
if profile, ok := app.peers[onion]; ok {
|
if profile, ok := app.peers[onion]; ok {
|
||||||
return profile
|
return profile
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue