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
33f9570e
Commit
33f9570e
authored
1 month ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
adapt for Asio 1.34
parent
c2d8b193
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/http.cpp
+10
-10
10 additions, 10 deletions
src/http.cpp
src/peer_discovery.cpp
+4
-4
4 additions, 4 deletions
src/peer_discovery.cpp
with
14 additions
and
14 deletions
src/http.cpp
+
10
−
10
View file @
33f9570e
...
...
@@ -456,7 +456,7 @@ Connection::set_ssl_verification(const std::string& hostname, const asio::ssl::v
}
// starts from CA and goes down the presented chain
auto
verifier
=
asio
::
ssl
::
rfc2818
_verification
(
hostname
);
auto
verifier
=
asio
::
ssl
::
host_name
_verification
(
hostname
);
bool
verified
=
verifier
(
preverified
,
ctx
);
auto
verify_ec
=
X509_STORE_CTX_get_error
(
ctx
.
native_handle
());
if
(
verify_ec
!=
0
/*X509_V_OK*/
and
logger
)
...
...
@@ -591,12 +591,12 @@ Connection::async_write(BytesHandlerCb cb)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
!
is_open
())
{
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
return
;
}
if
(
ssl_socket_
)
asio
::
async_write
(
*
ssl_socket_
,
write_buf_
,
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
socket_
)
asio
::
async_write
(
*
socket_
,
write_buf_
,
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
else
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
}
void
...
...
@@ -604,12 +604,12 @@ Connection::async_read_until(const char* delim, BytesHandlerCb cb)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
!
is_open
())
{
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
return
;
}
if
(
ssl_socket_
)
asio
::
async_read_until
(
*
ssl_socket_
,
read_buf_
,
delim
,
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
socket_
)
asio
::
async_read_until
(
*
socket_
,
read_buf_
,
delim
,
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
else
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
}
void
...
...
@@ -617,12 +617,12 @@ Connection::async_read_until(char delim, BytesHandlerCb cb)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
!
is_open
())
{
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
return
;
}
if
(
ssl_socket_
)
asio
::
async_read_until
(
*
ssl_socket_
,
read_buf_
,
delim
,
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
socket_
)
asio
::
async_read_until
(
*
socket_
,
read_buf_
,
delim
,
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
else
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
}
void
...
...
@@ -630,12 +630,12 @@ Connection::async_read(size_t bytes, BytesHandlerCb cb)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
!
is_open
())
{
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
return
;
}
if
(
ssl_socket_
)
asio
::
async_read
(
*
ssl_socket_
,
read_buf_
,
asio
::
transfer_exactly
(
bytes
),
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
socket_
)
asio
::
async_read
(
*
socket_
,
read_buf_
,
asio
::
transfer_exactly
(
bytes
),
wrapCallback
(
std
::
move
(
cb
)));
else
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
else
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
operation_aborted
,
0
);
});
}
void
...
...
@@ -643,7 +643,7 @@ Connection::async_read_some(size_t bytes, BytesHandlerCb cb)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
!
is_open
())
{
if
(
cb
)
ctx_
.
post
(
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
if
(
cb
)
asio
::
post
(
ctx_
,
[
cb
](){
cb
(
asio
::
error
::
broken_pipe
,
0
);
});
return
;
}
auto
buf
=
read_buf_
.
prepare
(
bytes
);
...
...
This diff is collapsed.
Click to expand it.
src/peer_discovery.cpp
+
4
−
4
View file @
33f9570e
...
...
@@ -97,7 +97,7 @@ PeerDiscovery::DomainPeerDiscovery::DomainPeerDiscovery(asio::ip::udp domain, in
,
ioContext_
(
ioContext
)
,
peerDiscoveryTimer
(
*
ioContext_
)
,
sockFd_
(
*
ioContext_
,
domain
)
,
sockAddrSend_
(
asio
::
ip
::
address
::
from_string
(
domain
.
family
()
==
AF_INET
?
MULTICAST_ADDRESS_IPV4
,
sockAddrSend_
(
asio
::
ip
::
make_
address
(
domain
.
family
()
==
AF_INET
?
MULTICAST_ADDRESS_IPV4
:
MULTICAST_ADDRESS_IPV6
),
port
)
{
try
{
...
...
@@ -139,7 +139,7 @@ PeerDiscovery::DomainPeerDiscovery::startDiscovery(const std::string &type, Serv
callbackmap_
[
type
]
=
callback
;
if
(
not
drunning_
)
{
drunning_
=
true
;
ioContext_
->
post
(
[
this
]
()
{
asio
::
post
(
*
ioContext_
,
[
this
]
()
{
loopListener
();
query
(
sockAddrSend_
);
});
...
...
@@ -245,7 +245,7 @@ PeerDiscovery::DomainPeerDiscovery::startPublish(const std::string &type, const
messages_
[
type
]
=
std
::
move
(
pack_buf_c
);
reloadMessages
();
lrunning_
=
true
;
ioContext_
->
post
(
[
this
]
()
{
publish
(
sockAddrSend_
);
});
asio
::
post
(
*
ioContext_
,
[
this
]
()
{
publish
(
sockAddrSend_
);
});
}
bool
...
...
@@ -327,7 +327,7 @@ PeerDiscovery::DomainPeerDiscovery::reDiscover()
void
PeerDiscovery
::
DomainPeerDiscovery
::
connectivityChanged
()
{
ioContext_
->
post
(
[
this
]
()
{
asio
::
post
(
*
ioContext_
,
[
this
]
()
{
reDiscover
();
publish
(
sockAddrSend_
);
});
...
...
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