Skip to content

Commit

Permalink
Use underlying for io.Copy() only
Browse files Browse the repository at this point in the history
  • Loading branch information
RPRX authored Feb 26, 2023
1 parent 14f5d53 commit f34b4d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func Server(ctx context.Context, conn net.Conn, config *Config) (*Conn, error) {
break
}
readerConn := &ReaderConn{
Conn: underlying,
Conn: conn,
Reader: bytes.NewReader(c2sSaved),
}
hs.c = &Conn{
Expand Down Expand Up @@ -247,15 +247,15 @@ func Server(ctx context.Context, conn net.Conn, config *Config) (*Conn, error) {
(config.MaxClientVer == nil || Value(hs.c.ClientVer[:]...) <= Value(config.MaxClientVer...)) &&
(config.MaxTimeDiff == 0 || time.Since(hs.c.ClientTime).Abs() <= config.MaxTimeDiff) &&
(config.ShortIds[hs.c.ClientShortId]) {
hs.c.conn = underlying
hs.c.conn = conn
}
hs.clientHello.keyShares[0].group = CurveID(i)
break
}
if config.Show {
fmt.Printf("REALITY remoteAddr: %v\ths.c.conn == underlying: %v\n", remoteAddr, hs.c.conn == underlying)
fmt.Printf("REALITY remoteAddr: %v\ths.c.conn == conn: %v\n", remoteAddr, hs.c.conn == conn)
}
if hs.c.conn == underlying {
if hs.c.conn == conn {
done = true
}
break
Expand Down Expand Up @@ -288,7 +288,7 @@ func Server(ctx context.Context, conn net.Conn, config *Config) (*Conn, error) {
}
mutex.Lock()
s2cSaved = append(s2cSaved, buf[:n]...)
if hs.c == nil || hs.c.conn != underlying {
if hs.c == nil || hs.c.conn != conn {
if _, err = conn.Write(buf[:n]); err != nil {
done = true
break
Expand Down

0 comments on commit f34b4d1

Please sign in to comment.