Revert "修复一个导致 TPROXY 下 v2ray 断流的问题"

pull/2514/head
Kslr 2020-05-31 11:58:24 +08:00 committed by GitHub
parent b355c7089b
commit db29bea2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 28 deletions

View File

@ -187,15 +187,6 @@ func (c *udpConn) Write(buf []byte) (int, error) {
return n, err
}
// Implements buf.ActivityNotifiable
func (c *udpConn) NotifyActivity() error {
if c.done.Done() {
return newError("connection is already closed")
}
c.updateActivity()
return nil
}
func (c *udpConn) Close() error {
common.Must(c.done.Close())
common.Must(common.Close(c.writer))

View File

@ -8,11 +8,6 @@ import (
"v2ray.com/core/common/signal"
)
// ActivityNotifiable is a object that accepts activity notification outside the object
type ActivityNotifiable interface {
NotifyActivity() error
}
type dataHandler func(MultiBuffer)
type copyHandler struct {
@ -36,15 +31,6 @@ func UpdateActivity(timer signal.ActivityUpdater) CopyOption {
}
}
// NotifyActivity is a CopyOption to notify activity on each data copy operation.
func NotifyActivity(notifier ActivityNotifiable) CopyOption {
return func(handler *copyHandler) {
handler.onData = append(handler.onData, func(MultiBuffer) {
notifier.NotifyActivity()
})
}
}
// CountSize is a CopyOption that sums the total size of data copied into the given SizeCounter.
func CountSize(sc *SizeCounter) CopyOption {
return func(handler *copyHandler) {

View File

@ -164,10 +164,6 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
writer = &buf.SequentialWriter{Writer: tConn}
tReader := buf.NewPacketReader(tConn)
notify, ok := conn.(buf.ActivityNotifiable)
if !ok {
panic("conn should implement ActivityNotifiable")
}
requestCount++
tproxyRequest = func() error {
defer func() {
@ -175,7 +171,7 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
timer.SetTimeout(plcy.Timeouts.DownlinkOnly)
}
}()
if err := buf.Copy(tReader, link.Writer, buf.UpdateActivity(timer), buf.NotifyActivity(notify)); err != nil {
if err := buf.Copy(tReader, link.Writer, buf.UpdateActivity(timer)); err != nil {
return newError("failed to transport request (TPROXY conn)").Base(err)
}
return nil