1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-18 22:17:44 +02:00

Provide Links() method in Tunnel

This commit is contained in:
Asim Aslam
2019-09-04 15:41:57 +01:00
parent 7ab3934eb7
commit d559ce9da2
4 changed files with 40 additions and 20 deletions

View File

@ -81,14 +81,24 @@ func (l *link) run() {
}
}
func (l *link) Close() {
func (l *link) Id() string {
l.RLock()
defer l.RUnlock()
return l.id
}
func (l *link) Close() error {
l.Lock()
defer l.Unlock()
select {
case <-l.closed:
return
return nil
default:
close(l.closed)
return l.Socket.Close()
}
return nil
}