Skip to content

Commit

Permalink
Merge pull request #24 from Aceeri/dev
Browse files Browse the repository at this point in the history
Check for nil client on serviceProxy
  • Loading branch information
senseijack authored Aug 21, 2018
2 parents 4754636 + d277b88 commit d6b5f37
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scamp/serviceproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type serviceProxy struct {

func (sp *serviceProxy) GetClient() (client *Client, err error) {
sp.clientM.Lock()
defer sp.clientM.Unlock()

//TODO: what really needs to happen is the removal of closed client from sp.client. Checking `sp.client.isClosed` is a bandaid
if sp.client == nil || sp.client.isClosed {
Expand All @@ -67,10 +68,13 @@ func (sp *serviceProxy) GetClient() (client *Client, err error) {
}

client = sp.client
if client == nil {
return nil, fmt.Errorf("client is nil")
}

//using ident so that we can set the service proxy's client to nil in client.Close()
client.spIdent = sp.ident

sp.clientM.Unlock()
return
}

Expand Down

0 comments on commit d6b5f37

Please sign in to comment.