Skip to content

Commit

Permalink
Adding DeregisterDialContext (#1422)
Browse files Browse the repository at this point in the history
Co-authored-by: jypelle <jy@fabriks.eu>
  • Loading branch information
jypelle and jypelle committed May 1, 2023
1 parent cffc85c commit fbfb3f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ INADA Naoki <songofacandy at gmail.com>
Jacek Szwec <szwec.jacek at gmail.com>
James Harr <james.harr at gmail.com>
Janek Vedock <janekvedock at comcast.net>
Jean-Yves Pellé <jy at pelle.link>
Jeff Hodges <jeff at somethingsimilar.com>
Jeffrey Charles <jeffreycharles at gmail.com>
Jerome Meyer <jxmeyer at gmail.com>
Expand Down
11 changes: 11 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ func RegisterDialContext(net string, dial DialContextFunc) {
dials[net] = dial
}

// DeregisterDialContext removes the custom dial function registered with the given net.
func DeregisterDialContext(net string) {
dialsLock.Lock()
defer dialsLock.Unlock()
if dials != nil {
if _, ok := dials[net]; ok {
delete(dials, net)
}
}
}

// RegisterDial registers a custom dial function. It can then be used by the
// network address mynet(addr), where mynet is the registered new network.
// addr is passed as a parameter to the dial function.
Expand Down

0 comments on commit fbfb3f6

Please sign in to comment.