1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 23:47:07 -05:00

remove unused variables

This commit is contained in:
v2ray 2016-07-03 00:27:01 +02:00
parent 490f77b4a0
commit e5c4fd3e1c
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -9,7 +9,6 @@ import (
"github.com/v2ray/v2ray-core/common/alloc" "github.com/v2ray/v2ray-core/common/alloc"
"github.com/v2ray/v2ray-core/common/log" "github.com/v2ray/v2ray-core/common/log"
"github.com/v2ray/v2ray-core/common/signal"
) )
var ( var (
@ -23,15 +22,6 @@ const (
headerSize uint32 = 2 headerSize uint32 = 2
) )
type ConnState byte
var (
ConnStateActive ConnState = 0
ConnStateReadyToClose ConnState = 1
ConnStatePeerClosed ConnState = 2
ConnStateClosed ConnState = 4
)
func nowMillisec() int64 { func nowMillisec() int64 {
now := time.Now() now := time.Now()
return now.Unix()*1000 + int64(now.Nanosecond()/1000000) return now.Unix()*1000 + int64(now.Nanosecond()/1000000)
@ -40,24 +30,19 @@ func nowMillisec() int64 {
// Connection is a KCP connection over UDP. // Connection is a KCP connection over UDP.
type Connection struct { type Connection struct {
sync.RWMutex sync.RWMutex
state ConnState
kcp *KCP // the core ARQ kcp *KCP // the core ARQ
kcpAccess sync.Mutex kcpAccess sync.Mutex
block Authenticator block Authenticator
needUpdate bool
local, remote net.Addr local, remote net.Addr
wd time.Time // write deadline wd time.Time // write deadline
chReadEvent chan struct{}
writer io.WriteCloser writer io.WriteCloser
since int64 since int64
terminateOnce signal.Once
} }
// NewConnection create a new KCP connection between local and remote. // NewConnection create a new KCP connection between local and remote.
func NewConnection(conv uint16, writerCloser io.WriteCloser, local *net.UDPAddr, remote *net.UDPAddr, block Authenticator) *Connection { func NewConnection(conv uint16, writerCloser io.WriteCloser, local *net.UDPAddr, remote *net.UDPAddr, block Authenticator) *Connection {
conn := new(Connection) conn := new(Connection)
conn.local = local conn.local = local
conn.chReadEvent = make(chan struct{}, 1)
conn.remote = remote conn.remote = remote
conn.block = block conn.block = block
conn.writer = writerCloser conn.writer = writerCloser
@ -208,20 +193,11 @@ func (this *Connection) updateTask() {
this.Terminate() this.Terminate()
} }
func (this *Connection) notifyReadEvent() {
select {
case this.chReadEvent <- struct{}{}:
default:
}
}
func (this *Connection) kcpInput(data []byte) { func (this *Connection) kcpInput(data []byte) {
this.kcpAccess.Lock() this.kcpAccess.Lock()
this.kcp.current = this.Elapsed() this.kcp.current = this.Elapsed()
this.kcp.Input(data) this.kcp.Input(data)
this.kcpAccess.Unlock() this.kcpAccess.Unlock()
this.notifyReadEvent()
} }
func (this *Connection) FetchInputFrom(conn net.Conn) { func (this *Connection) FetchInputFrom(conn net.Conn) {