Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
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
savoirfairelinux
opendht
Commits
e2d7dbc2
Commit
e2d7dbc2
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy client: declare mutex before protected objects
parent
090da49f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/dht_proxy_client.h
+14
-14
14 additions, 14 deletions
include/opendht/dht_proxy_client.h
src/dht_proxy_client.cpp
+2
-0
2 additions, 0 deletions
src/dht_proxy_client.cpp
with
16 additions
and
14 deletions
include/opendht/dht_proxy_client.h
+
14
−
14
View file @
e2d7dbc2
...
@@ -330,18 +330,6 @@ private:
...
@@ -330,18 +330,6 @@ private:
//std::pair<std::string, std::string> serverHostService_;
//std::pair<std::string, std::string> serverHostService_;
std
::
string
pushClientId_
;
std
::
string
pushClientId_
;
/*
* ASIO I/O Context for sockets in httpClient_
* Note: Each context is used in one thread only
*/
asio
::
io_context
httpContext_
;
std
::
shared_ptr
<
http
::
Resolver
>
resolver_
;
std
::
map
<
unsigned
int
/*id*/
,
std
::
shared_ptr
<
http
::
Request
>>
requests_
;
/*
* Thread for executing the http io_context.run() blocking call
*/
std
::
thread
httpClientThread_
;
mutable
std
::
mutex
lockCurrentProxyInfos_
;
mutable
std
::
mutex
lockCurrentProxyInfos_
;
NodeStatus
statusIpv4_
{
NodeStatus
::
Disconnected
};
NodeStatus
statusIpv4_
{
NodeStatus
::
Disconnected
};
NodeStatus
statusIpv6_
{
NodeStatus
::
Disconnected
};
NodeStatus
statusIpv6_
{
NodeStatus
::
Disconnected
};
...
@@ -355,20 +343,32 @@ private:
...
@@ -355,20 +343,32 @@ private:
// registred types
// registred types
TypeStore
types
;
TypeStore
types
;
/*
* ASIO I/O Context for sockets in httpClient_
* Note: Each context is used in one thread only
*/
asio
::
io_context
httpContext_
;
std
::
shared_ptr
<
http
::
Resolver
>
resolver_
;
std
::
map
<
unsigned
int
/*id*/
,
std
::
shared_ptr
<
http
::
Request
>>
requests_
;
/*
* Thread for executing the http io_context.run() blocking call
*/
std
::
thread
httpClientThread_
;
/**
/**
* Store listen requests.
* Store listen requests.
*/
*/
struct
ProxySearch
;
struct
ProxySearch
;
mutable
std
::
mutex
searchLock_
;
size_t
listenerToken_
{
0
};
size_t
listenerToken_
{
0
};
std
::
map
<
InfoHash
,
ProxySearch
>
searches_
;
std
::
map
<
InfoHash
,
ProxySearch
>
searches_
;
mutable
std
::
mutex
searchLock_
;
/**
/**
* Callbacks should be executed in the main thread.
* Callbacks should be executed in the main thread.
*/
*/
std
::
vector
<
std
::
function
<
void
()
>>
callbacks_
;
std
::
mutex
lockCallbacks_
;
std
::
mutex
lockCallbacks_
;
std
::
vector
<
std
::
function
<
void
()
>>
callbacks_
;
Sp
<
InfoState
>
infoState_
;
Sp
<
InfoState
>
infoState_
;
...
...
This diff is collapsed.
Click to expand it.
src/dht_proxy_client.cpp
+
2
−
0
View file @
e2d7dbc2
...
@@ -981,6 +981,8 @@ DhtProxyClient::sendListen(const restinio::http_request_header_t header,
...
@@ -981,6 +981,8 @@ DhtProxyClient::sendListen(const restinio::http_request_header_t header,
void
void
DhtProxyClient
::
opFailed
()
DhtProxyClient
::
opFailed
()
{
{
if
(
isDestroying_
)
return
;
if
(
logger_
)
if
(
logger_
)
logger_
->
e
(
"[proxy:client] proxy request failed"
);
logger_
->
e
(
"[proxy:client] proxy request failed"
);
{
{
...
...
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