mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-30 10:10:44 +02:00
[fix] http transport deadlock (#2441)
Co-authored-by: Hunyadvári Péter <peter.hunyadvari@vcc.live>
This commit is contained in:
parent
4154ed6a80
commit
dca3a3b553
@ -141,6 +141,7 @@ func (h *httpTransportClient) Recv(m *Message) error {
|
||||
|
||||
h.Lock()
|
||||
if h.closed {
|
||||
h.Unlock()
|
||||
return io.EOF
|
||||
}
|
||||
rsp, err := http.ReadResponse(h.buff, r)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package transport
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
@ -303,11 +302,11 @@ func TestHTTPTransportCloseWhenRecv(t *testing.T) {
|
||||
|
||||
if err := c.Recv(&rm); err != nil {
|
||||
if err == io.EOF {
|
||||
c.Recv(&rm)
|
||||
return
|
||||
}
|
||||
t.Errorf("Unexpected recv err: %v", err)
|
||||
}
|
||||
fmt.Println("aa")
|
||||
}
|
||||
}()
|
||||
for i := 1; i < 3; i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user