Skip to content

Commit

Permalink
remove changes to maxUploadSize
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmray committed Jul 27, 2024
1 parent f372e2d commit 2932fb9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 57 deletions.
7 changes: 2 additions & 5 deletions infra/conf/transport_internet.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ type SplitHTTPConfig struct {
Path string `json:"path"`
Headers map[string]string `json:"headers"`
MaxConcurrentUploads int32 `json:"maxConcurrentUploads"`
MaxUploadSize Int32Range `json:"maxUploadSize"`
MaxUploadSize int32 `json:"maxUploadSize"`
MinUploadIntervalMs Int32Range `json:"minUploadIntervalMs"`
}

Expand All @@ -249,10 +249,7 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
Host: c.Host,
Header: c.Headers,
MaxConcurrentUploads: c.MaxConcurrentUploads,
MaxUploadSize: &splithttp.RandRangeConfig{
From: c.MaxUploadSize.From,
To: c.MaxUploadSize.To,
},
MaxUploadSize: c.MaxUploadSize,
MinUploadIntervalMs: &splithttp.RandRangeConfig{
From: c.MinUploadIntervalMs.From,
To: c.MinUploadIntervalMs.To,
Expand Down
13 changes: 4 additions & 9 deletions transport/internet/splithttp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,12 @@ func (c *Config) GetNormalizedMaxConcurrentUploads() int32 {
return c.MaxConcurrentUploads
}

func (c *Config) GetNormalizedMaxUploadSize() RandRangeConfig {
r := c.MaxUploadSize

if r == nil {
r = &RandRangeConfig{
From: 1000000,
To: 1000000,
}
func (c *Config) GetNormalizedMaxUploadSize() int32 {
if c.MaxUploadSize == 0 {
return 1000000
}

return *r
return c.MaxUploadSize
}

func (c *Config) GetNormalizedMinUploadInterval() RandRangeConfig {
Expand Down
78 changes: 37 additions & 41 deletions transport/internet/splithttp/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion transport/internet/splithttp/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ message Config {
string path = 2;
map<string, string> header = 3;
int32 maxConcurrentUploads = 4;
RandRangeConfig maxUploadSize = 5;
int32 maxUploadSize = 5;
RandRangeConfig minUploadIntervalMs = 6;
}

Expand Down
2 changes: 1 addition & 1 deletion transport/internet/splithttp/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
sessionId := sessionIdUuid.String()
baseURL := requestURL.String() + sessionId

uploadPipeReader, uploadPipeWriter := pipe.New(pipe.WithSizeLimit(maxUploadSize.roll()))
uploadPipeReader, uploadPipeWriter := pipe.New(pipe.WithSizeLimit(maxUploadSize))

go func() {
requestsLimiter := semaphore.New(int(maxConcurrentUploads))
Expand Down

0 comments on commit 2932fb9

Please sign in to comment.