Chore: Listener should not expose original net.Listener
This commit is contained in:
@ -17,10 +17,10 @@ import (
|
||||
)
|
||||
|
||||
type Listener struct {
|
||||
net.Listener
|
||||
address string
|
||||
closed bool
|
||||
cache *cache.Cache
|
||||
listener net.Listener
|
||||
address string
|
||||
closed bool
|
||||
cache *cache.Cache
|
||||
}
|
||||
|
||||
func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
|
||||
@ -31,7 +31,7 @@ func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
|
||||
hl := &Listener{l, addr, false, cache.New(30 * time.Second)}
|
||||
go func() {
|
||||
for {
|
||||
c, err := hl.Accept()
|
||||
c, err := hl.listener.Accept()
|
||||
if err != nil {
|
||||
if hl.closed {
|
||||
break
|
||||
@ -47,7 +47,7 @@ func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
|
||||
|
||||
func (l *Listener) Close() {
|
||||
l.closed = true
|
||||
l.Listener.Close()
|
||||
l.listener.Close()
|
||||
}
|
||||
|
||||
func (l *Listener) Address() string {
|
||||
|
Reference in New Issue
Block a user