Skip to content

Commit 2ad58e3

Browse files
committed
nit
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
1 parent e6f4f75 commit 2ad58e3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

network/p2p/p2ptest/client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func NewClient(
3838
require.NoError(t, err)
3939

4040
clientSender.SendAppGossipF = func(ctx context.Context, _ common.SendConfig, gossipBytes []byte) error {
41+
// Send the request asynchronously to avoid deadlock when the server
42+
// sends the response back to the client
4143
go func() {
4244
require.NoError(t, serverNetwork.AppGossip(ctx, clientNodeID, gossipBytes))
4345
}()
@@ -56,6 +58,8 @@ func NewClient(
5658
}
5759

5860
serverSender.SendAppResponseF = func(ctx context.Context, _ ids.NodeID, requestID uint32, responseBytes []byte) error {
61+
// Send the request asynchronously to avoid deadlock when the server
62+
// sends the response back to the client
5963
go func() {
6064
require.NoError(t, clientNetwork.AppResponse(ctx, serverNodeID, requestID, responseBytes))
6165
}()
@@ -64,6 +68,8 @@ func NewClient(
6468
}
6569

6670
serverSender.SendAppErrorF = func(ctx context.Context, _ ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error {
71+
// Send the request asynchronously to avoid deadlock when the server
72+
// sends the response back to the client
6773
go func() {
6874
require.NoError(t, clientNetwork.AppRequestFailed(ctx, serverNodeID, requestID, &common.AppError{
6975
Code: errorCode,

0 commit comments

Comments
 (0)