Skip to content

Commit

Permalink
Send shadowsocks handshake with payload if available
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Sep 25, 2021
1 parent c278db5 commit 543c799
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions proxy/shadowsocks/client.go
Expand Up @@ -5,6 +5,7 @@ package shadowsocks

import (
"context"
"time"

core "github.com/v2fly/v2ray-core/v4"
"github.com/v2fly/v2ray-core/v4/common"
Expand Down Expand Up @@ -108,6 +109,10 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
return newError("failed to write request").Base(err)
}

if err = buf.CopyOnceTimeout(link.Reader, bodyWriter, time.Millisecond*100); err != nil && err != buf.ErrNotTimeoutReader && err != buf.ErrReadTimeout {
return newError("failed to write A request payload").Base(err).AtWarning()
}

if err := bufferedWriter.SetBuffered(false); err != nil {
return err
}
Expand Down

0 comments on commit 543c799

Please sign in to comment.