Use SyncWrite call to send a packet to proxy

This commit is contained in:
9seconds
2026-03-13 14:44:56 +01:00
parent 33c0fa9bf7
commit 4138cc6494
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -247,7 +247,7 @@ func (suite *ConnTestSuite) TestSyncWriteBlocksAsyncWrite() {
go func() { go func() {
defer close(syncDone) defer close(syncDone)
c.SyncWrite([]byte("exclusive")) c.SyncWrite([]byte("exclusive")) //nolint: errcheck
}() }()
// Give SyncWrite time to acquire the lock. // Give SyncWrite time to acquire the lock.
@@ -258,7 +258,7 @@ func (suite *ConnTestSuite) TestSyncWriteBlocksAsyncWrite() {
go func() { go func() {
defer close(writeDone) defer close(writeDone)
c.Write([]byte("blocked")) c.Write([]byte("blocked")) //nolint: errcheck
}() }()
// SyncWrite should finish first. // SyncWrite should finish first.
+1 -1
View File
@@ -90,7 +90,7 @@ func (p *Proxy) ServeConn(conn essentials.Conn) {
} }
defer clientConn.Stop() defer clientConn.Stop()
if _, err := clientConn.Write(noise); err != nil { if _, err := clientConn.SyncWrite(noise); err != nil {
ctx.logger.InfoError("cannot send the first packet", err) ctx.logger.InfoError("cannot send the first packet", err)
return return
} }