@@ -70,14 +70,11 @@ type GraphSync struct {
70
70
ctx context.Context
71
71
cancel context.CancelFunc
72
72
responseAllocator * allocator.Allocator
73
- requestAllocator * allocator.Allocator
74
73
}
75
74
76
75
type graphsyncConfigOptions struct {
77
76
totalMaxMemoryResponder uint64
78
77
maxMemoryPerPeerResponder uint64
79
- totalMaxMemoryRequestor uint64
80
- maxMemoryPerPeerRequestor uint64
81
78
maxInProgressIncomingRequests uint64
82
79
maxInProgressIncomingRequestsPerPeer uint64
83
80
maxInProgressOutgoingRequests uint64
@@ -116,22 +113,6 @@ func MaxMemoryPerPeerResponder(maxMemoryPerPeer uint64) Option {
116
113
}
117
114
}
118
115
119
- // MaxMemoryRequestor defines the maximum amount of memory the responder
120
- // may consume queueing up messages for a response in total
121
- func MaxMemoryRequestor (totalMaxMemory uint64 ) Option {
122
- return func (gs * graphsyncConfigOptions ) {
123
- gs .totalMaxMemoryRequestor = totalMaxMemory
124
- }
125
- }
126
-
127
- // MaxMemoryPerPeerRequestor defines the maximum amount of memory a peer
128
- // may consume queueing up messages for a response
129
- func MaxMemoryPerPeerRequestor (maxMemoryPerPeer uint64 ) Option {
130
- return func (gs * graphsyncConfigOptions ) {
131
- gs .maxMemoryPerPeerRequestor = maxMemoryPerPeer
132
- }
133
- }
134
-
135
116
// MaxInProgressIncomingRequests changes the maximum number of
136
117
// incoming graphsync requests that are processed in parallel (default 6)
137
118
func MaxInProgressIncomingRequests (maxInProgressIncomingRequests uint64 ) Option {
@@ -214,8 +195,6 @@ func New(parent context.Context, network gsnet.GraphSyncNetwork,
214
195
gsConfig := & graphsyncConfigOptions {
215
196
totalMaxMemoryResponder : defaultTotalMaxMemory ,
216
197
maxMemoryPerPeerResponder : defaultMaxMemoryPerPeer ,
217
- totalMaxMemoryRequestor : defaultTotalMaxMemory ,
218
- maxMemoryPerPeerRequestor : defaultMaxMemoryPerPeer ,
219
198
maxInProgressIncomingRequests : defaultMaxInProgressRequests ,
220
199
maxInProgressOutgoingRequests : defaultMaxInProgressRequests ,
221
200
registerDefaultValidator : true ,
@@ -247,9 +226,8 @@ func New(parent context.Context, network gsnet.GraphSyncNetwork,
247
226
return messagequeue .New (ctx , p , network , responseAllocator , gsConfig .messageSendRetries , gsConfig .sendMessageTimeout )
248
227
}
249
228
peerManager := peermanager .NewMessageManager (ctx , createMessageQueue )
250
- requestAllocator := allocator .NewAllocator (gsConfig .totalMaxMemoryRequestor , gsConfig .maxMemoryPerPeerRequestor )
251
229
252
- asyncLoader := asyncloader .New (ctx , linkSystem , requestAllocator )
230
+ asyncLoader := asyncloader .New (ctx , linkSystem )
253
231
requestQueue := taskqueue .NewTaskQueue (ctx )
254
232
requestManager := requestmanager .New (ctx , asyncLoader , linkSystem , outgoingRequestHooks , incomingResponseHooks , networkErrorListeners , outgoingRequestProcessingListeners , requestQueue , network .ConnectionManager (), gsConfig .maxLinksPerOutgoingRequest )
255
233
requestExecutor := executor .NewExecutor (requestManager , incomingBlockHooks , asyncLoader .AsyncLoad )
@@ -313,7 +291,6 @@ func New(parent context.Context, network gsnet.GraphSyncNetwork,
313
291
ctx : ctx ,
314
292
cancel : cancel ,
315
293
responseAllocator : responseAllocator ,
316
- requestAllocator : requestAllocator ,
317
294
}
318
295
319
296
requestManager .SetDelegate (peerManager )
@@ -453,7 +430,6 @@ func (gs *GraphSync) CancelRequest(ctx context.Context, requestID graphsync.Requ
453
430
// Stats produces insight on the current state of a graphsync exchange
454
431
func (gs * GraphSync ) Stats () graphsync.Stats {
455
432
outgoingRequestStats := gs .requestQueue .Stats ()
456
- incomingResponseStats := gs .requestAllocator .Stats ()
457
433
458
434
ptqstats := gs .peerTaskQueue .Stats ()
459
435
incomingRequestStats := graphsync.RequestStats {
@@ -465,8 +441,6 @@ func (gs *GraphSync) Stats() graphsync.Stats {
465
441
466
442
return graphsync.Stats {
467
443
OutgoingRequests : outgoingRequestStats ,
468
- IncomingResponses : incomingResponseStats ,
469
-
470
444
IncomingRequests : incomingRequestStats ,
471
445
OutgoingResponses : outgoingResponseStats ,
472
446
}
@@ -485,14 +459,6 @@ func (gsr *graphSyncReceiver) ReceiveMessage(
485
459
sender peer.ID ,
486
460
incoming gsmsg.GraphSyncMessage ) {
487
461
gsr .graphSync ().responseManager .ProcessRequests (ctx , sender , incoming .Requests ())
488
- totalMemoryAllocated := uint64 (0 )
489
- for _ , blk := range incoming .Blocks () {
490
- totalMemoryAllocated += uint64 (len (blk .RawData ()))
491
- }
492
- select {
493
- case <- gsr .graphSync ().requestAllocator .AllocateBlockMemory (sender , totalMemoryAllocated ):
494
- case <- gsr .ctx .Done ():
495
- }
496
462
gsr .graphSync ().requestManager .ProcessResponses (sender , incoming .Responses (), incoming .Blocks ())
497
463
}
498
464
0 commit comments