Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Kim <[email protected]>
  • Loading branch information
joshua-kim committed Sep 24, 2024
1 parent e6f4f75 commit 2ad58e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions network/p2p/p2ptest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func NewClient(
require.NoError(t, err)

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

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

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

0 comments on commit 2ad58e3

Please sign in to comment.