@@ -38,6 +38,8 @@ func NewClient(
38
38
require .NoError (t , err )
39
39
40
40
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
41
43
go func () {
42
44
require .NoError (t , serverNetwork .AppGossip (ctx , clientNodeID , gossipBytes ))
43
45
}()
@@ -56,6 +58,8 @@ func NewClient(
56
58
}
57
59
58
60
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
59
63
go func () {
60
64
require .NoError (t , clientNetwork .AppResponse (ctx , serverNodeID , requestID , responseBytes ))
61
65
}()
@@ -64,6 +68,8 @@ func NewClient(
64
68
}
65
69
66
70
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
67
73
go func () {
68
74
require .NoError (t , clientNetwork .AppRequestFailed (ctx , serverNodeID , requestID , & common.AppError {
69
75
Code : errorCode ,
0 commit comments