Skip to content

Commit

Permalink
rpc: fix defer in test (ethereum#24490)
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Lange <[email protected]>
  • Loading branch information
s7v7nislands and fjl authored Mar 11, 2022
1 parent 8f66ea3 commit 496f05c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rpc/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,16 @@ func TestServerShortLivedConn(t *testing.T) {
if err != nil {
t.Fatal("can't dial:", err)
}
defer conn.Close()

conn.SetDeadline(deadline)
// Write the request, then half-close the connection so the server stops reading.
conn.Write([]byte(request))
conn.(*net.TCPConn).CloseWrite()
// Now try to get the response.
buf := make([]byte, 2000)
n, err := conn.Read(buf)
conn.Close()

if err != nil {
t.Fatal("read error:", err)
}
Expand Down

0 comments on commit 496f05c

Please sign in to comment.