1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

rename TCPListener to TCPHub

This commit is contained in:
v2ray 2016-01-28 20:47:00 +01:00
parent 4be27a6377
commit 1f9bd5f692
6 changed files with 12 additions and 12 deletions

View File

@ -20,7 +20,7 @@ type DokodemoDoor struct {
address v2net.Address
port v2net.Port
space app.Space
tcpListener *hub.TCPListener
tcpListener *hub.TCPHub
udpHub *hub.UDPHub
listeningPort v2net.Port
}

View File

@ -24,7 +24,7 @@ type HttpProxyServer struct {
accepting bool
space app.Space
config *Config
tcpListener *hub.TCPListener
tcpListener *hub.TCPHub
listeningPort v2net.Port
}

View File

@ -20,7 +20,7 @@ type Shadowsocks struct {
config *Config
port v2net.Port
accepting bool
tcpListener *hub.TCPListener
tcpListener *hub.TCPHub
}
func (this *Shadowsocks) Port() v2net.Port {

View File

@ -28,7 +28,7 @@ type SocksServer struct {
accepting bool
space app.Space
config *Config
tcpListener *hub.TCPListener
tcpListener *hub.TCPHub
udpConn *net.UDPConn
udpAddress v2net.Destination
listeningPort v2net.Port

View File

@ -25,7 +25,7 @@ type VMessInboundHandler struct {
clients protocol.UserSet
user *vmess.User
accepting bool
listener *hub.TCPListener
listener *hub.TCPHub
features *FeaturesConfig
listeningPort v2net.Port
}

View File

@ -10,7 +10,7 @@ import (
type TCPConn struct {
conn *net.TCPConn
listener *TCPListener
listener *TCPHub
dirty bool
}
@ -62,13 +62,13 @@ func (this *TCPConn) CloseWrite() error {
return this.conn.CloseWrite()
}
type TCPListener struct {
type TCPHub struct {
listener *net.TCPListener
connCallback func(*TCPConn)
accepting bool
}
func ListenTCP(port v2net.Port, callback func(*TCPConn)) (*TCPListener, error) {
func ListenTCP(port v2net.Port, callback func(*TCPConn)) (*TCPHub, error) {
listener, err := net.ListenTCP("tcp", &net.TCPAddr{
IP: []byte{0, 0, 0, 0},
Port: int(port),
@ -77,7 +77,7 @@ func ListenTCP(port v2net.Port, callback func(*TCPConn)) (*TCPListener, error) {
if err != nil {
return nil, err
}
tcpListener := &TCPListener{
tcpListener := &TCPHub{
listener: listener,
connCallback: callback,
}
@ -85,12 +85,12 @@ func ListenTCP(port v2net.Port, callback func(*TCPConn)) (*TCPListener, error) {
return tcpListener, nil
}
func (this *TCPListener) Close() {
func (this *TCPHub) Close() {
this.accepting = false
this.listener.Close()
}
func (this *TCPListener) start() {
func (this *TCPHub) start() {
this.accepting = true
for this.accepting {
conn, err := this.listener.AcceptTCP()
@ -105,6 +105,6 @@ func (this *TCPListener) start() {
}
}
func (this *TCPListener) recycle(conn *net.TCPConn) {
func (this *TCPHub) recycle(conn *net.TCPConn) {
}