Skip to content

Commit f166f20

Browse files
committed
Set max number of chunks accepted by server
1 parent 21c4378 commit f166f20

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/registrars/dns-registrar/tworeqresp/responder.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
var interval = 30 * time.Second
1414

15+
const maxChunks = 10
16+
1517
type oneresponder interface {
1618
RecvAndRespond(getResponse func([]byte) ([]byte, error)) error
1719
Close() error
@@ -70,6 +72,10 @@ func (r *Responder) RecvAndRespond(parentGetResponse func([]byte) ([]byte, error
7072

7173
partId := (*[idLen]byte)(partIn.GetId())
7274

75+
if *partIn.TotalParts > maxChunks {
76+
return nil, fmt.Errorf("request over max chunk limit")
77+
}
78+
7379
r.mutex.Lock()
7480
regData, ok := r.parts[*partId]
7581

0 commit comments

Comments
 (0)