telebit/server/one_conn.go

33 lines
554 B
Go
Raw Normal View History

2017-04-01 04:19:50 +00:00
package server
import (
"io"
"net"
)
type oneConnListener struct {
conn net.Conn
}
func (l *oneConnListener) Accept() (net.Conn, error) {
if l.conn == nil {
2020-05-01 05:47:46 +00:00
loginfo.Println("oneConnListener Accept EOF")
return nil, io.EOF
}
c := l.conn
l.conn = nil
loginfo.Println("Accept", c.LocalAddr().String(), c.RemoteAddr().String())
return c, nil
}
func (l *oneConnListener) Close() error {
2020-05-01 05:47:46 +00:00
loginfo.Println("oneConnListener close")
return nil
}
func (l *oneConnListener) Addr() net.Addr {
2020-05-01 05:47:46 +00:00
loginfo.Println("oneConnLister addr")
return nil
}