Selaa lähdekoodia

Use SyncWrite call to send a packet to proxy

tags/v2.2.0^2^2
9seconds 1 kuukausi sitten
vanhempi
commit
4138cc6494
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 2
    2
      mtglib/internal/doppel/conn_test.go
  2. 1
    1
      mtglib/proxy.go

+ 2
- 2
mtglib/internal/doppel/conn_test.go Näytä tiedosto

@@ -247,7 +247,7 @@ func (suite *ConnTestSuite) TestSyncWriteBlocksAsyncWrite() {
247 247
 
248 248
 	go func() {
249 249
 		defer close(syncDone)
250
-		c.SyncWrite([]byte("exclusive"))
250
+		c.SyncWrite([]byte("exclusive")) //nolint: errcheck
251 251
 	}()
252 252
 
253 253
 	// Give SyncWrite time to acquire the lock.
@@ -258,7 +258,7 @@ func (suite *ConnTestSuite) TestSyncWriteBlocksAsyncWrite() {
258 258
 
259 259
 	go func() {
260 260
 		defer close(writeDone)
261
-		c.Write([]byte("blocked"))
261
+		c.Write([]byte("blocked")) //nolint: errcheck
262 262
 	}()
263 263
 
264 264
 	// SyncWrite should finish first.

+ 1
- 1
mtglib/proxy.go Näytä tiedosto

@@ -90,7 +90,7 @@ func (p *Proxy) ServeConn(conn essentials.Conn) {
90 90
 	}
91 91
 	defer clientConn.Stop()
92 92
 
93
-	if _, err := clientConn.Write(noise); err != nil {
93
+	if _, err := clientConn.SyncWrite(noise); err != nil {
94 94
 		ctx.logger.InfoError("cannot send the first packet", err)
95 95
 		return
96 96
 	}

Loading…
Peruuta
Tallenna