fix udp broken

pull/2348/head
FH0 2020-03-18 19:25:22 +08:00 committed by GitHub
parent 3feec68a87
commit 7cfa5aed18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -164,6 +164,10 @@ 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() {
@ -171,7 +175,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)); err != nil {
if err := buf.Copy(tReader, link.Writer, buf.UpdateActivity(timer), buf.NotifyActivity(notify)); err != nil {
return newError("failed to transport request (TPROXY conn)").Base(err)
}
return nil