1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-27 01:45:23 +00:00

terminate connection

This commit is contained in:
v2ray 2016-07-29 11:49:53 +02:00
parent 7385c05f29
commit b8421f659f
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -365,7 +365,7 @@ func (this *Connection) FetchInputFrom(conn io.Reader) {
go func() {
payload := alloc.NewLocalBuffer(2048)
defer payload.Release()
for {
for this.State() != StateTerminated {
payload.Reset()
nBytes, err := conn.Read(payload.Value)
if err != nil {
@ -391,6 +391,7 @@ func (this *Connection) Terminate() {
}
log.Info("KCP|Connection: Terminating connection to ", this.RemoteAddr())
this.SetState(StateTerminated)
this.writer.Close()
}