Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coeurl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
coeurl
Commits
5393e25d
Verified
Commit
5393e25d
authored
2 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Limit connections by default
parent
87517c54
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.markdownlint.yaml
+1
-0
1 addition, 0 deletions
.markdownlint.yaml
CHANGELOG.md
+14
-4
14 additions, 4 deletions
CHANGELOG.md
include/coeurl/client.hpp
+6
-0
6 additions, 0 deletions
include/coeurl/client.hpp
lib/client.cpp
+11
-0
11 additions, 0 deletions
lib/client.cpp
with
32 additions
and
4 deletions
.markdownlint.yaml
0 → 100644
+
1
−
0
View file @
5393e25d
default
:
true
,
This diff is collapsed.
Click to expand it.
CHANGELOG.md
+
14
−
4
View file @
5393e25d
CHANGELOG
=========
## [0.2.0] - 2022-03-06
[0.2.1] - unreleased
--------------------
-
Fix potential hang when the client is shutdown and a request is scheduled at the same time.
-
Limit concurrent connections to 64 and per host to 8 by default. You can
change that using 2 new functions.
## [0.1.1] - 2021-12-20
[0.2.0] - 2022-03-06
--------------------
-
Fix potential hang when the client is shutdown and a request is scheduled at
the same time.
[0.1.1] - 2021-12-20
--------------------
-
Add wrapper function to convert error codes to strings.
## [0.1.0] - 2021-11-14
[0.1.0] - 2021-11-14
--------------------
-
Initial release.
This diff is collapsed.
Click to expand it.
include/coeurl/client.hpp
+
6
−
0
View file @
5393e25d
...
...
@@ -145,6 +145,12 @@ struct Client {
//! stops sending acks.
void
connection_timeout
(
long
t
)
{
connection_timeout_
=
t
;
}
//! Maximum connections to open in parallel for this client. Set to 0 to disable the limit. Default is 64.
void
maximum_total_connections
(
long
count
);
//! Maximum connections to open in parallel for each specific host for this client. Set to 0 to disable the limit.
//! Default is 8.
void
maximum_connections_per_host
(
long
count
);
private
:
// Call this to run the event loop. Will block until the client is shutdown.
void
run
();
...
...
This diff is collapsed.
Click to expand it.
lib/client.cpp
+
11
−
0
View file @
5393e25d
...
...
@@ -232,9 +232,20 @@ Client::Client() {
curl_multi_setopt
(
this
->
multi
,
CURLMOPT_TIMERFUNCTION
,
multi_timer_cb
);
curl_multi_setopt
(
this
->
multi
,
CURLMOPT_TIMERDATA
,
this
);
maximum_total_connections
(
64
);
maximum_connections_per_host
(
8
);
bg_thread
=
std
::
thread
([
this
]()
{
this
->
run
();
});
}
void
Client
::
maximum_total_connections
(
long
count
)
{
curl_multi_setopt
(
this
->
multi
,
CURLMOPT_MAX_TOTAL_CONNECTIONS
,
count
);
}
void
Client
::
maximum_connections_per_host
(
long
count
)
{
curl_multi_setopt
(
this
->
multi
,
CURLMOPT_MAX_HOST_CONNECTIONS
,
count
);
}
Client
::~
Client
()
{
close
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment