mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
remove use of KeepAlive
This commit is contained in:
parent
7cd2d62d06
commit
cab5c10fc2
@ -1,8 +1,7 @@
|
||||
package mux
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
@ -54,10 +53,9 @@ func (w *Writer) getNextFrameMeta() FrameMetadata {
|
||||
func (w *Writer) writeMetaOnly() error {
|
||||
meta := w.getNextFrameMeta()
|
||||
b := buf.New()
|
||||
if err := b.AppendSupplier(meta.AsSupplier()); err != nil {
|
||||
if err := b.Reset(meta.AsSupplier()); err != nil {
|
||||
return err
|
||||
}
|
||||
runtime.KeepAlive(meta)
|
||||
return w.writer.Write(buf.NewMultiBufferValue(b))
|
||||
}
|
||||
|
||||
@ -66,10 +64,9 @@ func (w *Writer) writeData(mb buf.MultiBuffer) error {
|
||||
meta.Option.Set(OptionData)
|
||||
|
||||
frame := buf.New()
|
||||
if err := frame.AppendSupplier(meta.AsSupplier()); err != nil {
|
||||
if err := frame.Reset(meta.AsSupplier()); err != nil {
|
||||
return err
|
||||
}
|
||||
runtime.KeepAlive(meta)
|
||||
if err := frame.AppendSupplier(serial.WriteUint16(uint16(mb.Len()))); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -110,8 +107,7 @@ func (w *Writer) Close() {
|
||||
}
|
||||
|
||||
frame := buf.New()
|
||||
frame.AppendSupplier(meta.AsSupplier())
|
||||
runtime.KeepAlive(meta)
|
||||
common.Must(frame.Reset(meta.AsSupplier()))
|
||||
|
||||
w.writer.Write(buf.NewMultiBufferValue(frame))
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ package dokodemo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/app"
|
||||
@ -117,8 +116,6 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ package freedom
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/app"
|
||||
@ -139,8 +138,6 @@ func (v *Handler) Process(ctx context.Context, outboundRay ray.OutboundRay, dial
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"encoding/base64"
|
||||
"io"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -185,8 +184,6 @@ func (s *Server) handleConnect(ctx context.Context, request *http.Request, reade
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package shadowsocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/app/log"
|
||||
@ -168,8 +167,6 @@ func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, diale
|
||||
return nil
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package shadowsocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/app"
|
||||
@ -197,8 +196,6 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package socks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
@ -118,8 +117,6 @@ func (c *Client) Process(ctx context.Context, ray ray.OutboundRay, dialer proxy.
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package socks
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/app"
|
||||
@ -143,8 +142,6 @@ func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ package inbound
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -236,8 +235,6 @@ func (v *Handler) Process(ctx context.Context, network net.Network, connection i
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ package outbound
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/app"
|
||||
@ -162,7 +161,6 @@ func (v *Handler) Process(ctx context.Context, outboundRay ray.OutboundRay, dial
|
||||
if err := signal.ErrorOrFinish2(ctx, requestDone, responseDone); err != nil {
|
||||
return newError("connection ends").Base(err)
|
||||
}
|
||||
runtime.KeepAlive(timer)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user