Skip to content

Commit ee02532

Browse files
dyhkwongnekohasekai
authored andcommitted
Fix tlsfragment fallback writeAndWaitAck
1 parent f1dd0db commit ee02532

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

common/tlsfragment/conn.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func (c *Conn) Write(b []byte) (n int, err error) {
109109
if err != nil {
110110
return
111111
}
112+
if i != len(splitIndexes) {
113+
time.Sleep(c.fallbackDelay)
114+
}
112115
}
113116
}
114117
}

common/tlsfragment/wait_stub.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import (
99
)
1010

1111
func writeAndWaitAck(ctx context.Context, conn *net.TCPConn, payload []byte, fallbackDelay time.Duration) error {
12+
_, err := conn.Write(payload)
13+
if err != nil {
14+
return err
15+
}
1216
time.Sleep(fallbackDelay)
1317
return nil
1418
}

common/tlsfragment/wait_windows.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ func writeAndWaitAck(ctx context.Context, conn *net.TCPConn, payload []byte, fal
1616
err := winiphlpapi.WriteAndWaitAck(ctx, conn, payload)
1717
if err != nil {
1818
if errors.Is(err, windows.ERROR_ACCESS_DENIED) {
19+
if _, err := conn.Write(payload); err != nil {
20+
return err
21+
}
1922
time.Sleep(fallbackDelay)
2023
return nil
2124
}

0 commit comments

Comments
 (0)