Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dhtnet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
dhtnet
Commits
efb32d59
Commit
efb32d59
authored
1 month ago
by
Adrien Béraud
Committed by
Adrien Béraud
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
MultiplexedSocket: unlock during onChannelReady
Change-Id: I5c29a6f20ec6a338135f79126a85c0377222bb9b
parent
82d4e6b7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/multiplexed_socket.cpp
+4
-2
4 additions, 2 deletions
src/multiplexed_socket.cpp
with
4 additions
and
2 deletions
src/multiplexed_socket.cpp
+
4
−
2
View file @
efb32d59
...
@@ -284,19 +284,21 @@ MultiplexedSocket::Impl::eventLoop()
...
@@ -284,19 +284,21 @@ MultiplexedSocket::Impl::eventLoop()
void
void
MultiplexedSocket
::
Impl
::
onAccept
(
const
std
::
string
&
name
,
uint16_t
channel
)
MultiplexedSocket
::
Impl
::
onAccept
(
const
std
::
string
&
name
,
uint16_t
channel
)
{
{
std
::
lock_guard
lkSockets
(
socketsMutex
);
std
::
unique_lock
lk
(
socketsMutex
);
auto
&
socket
=
sockets
[
channel
];
auto
socket
=
sockets
[
channel
];
if
(
!
socket
)
{
if
(
!
socket
)
{
if
(
logger_
)
if
(
logger_
)
logger_
->
error
(
"Receiving an answer for a non existing channel. This is a bug."
);
logger_
->
error
(
"Receiving an answer for a non existing channel. This is a bug."
);
return
;
return
;
}
}
lk
.
unlock
();
onChannelReady_
(
deviceId
,
socket
);
onChannelReady_
(
deviceId
,
socket
);
socket
->
ready
(
true
);
socket
->
ready
(
true
);
// Due to the callbacks that can take some time, onAccept can arrive after
// Due to the callbacks that can take some time, onAccept can arrive after
// receiving all the data. In this case, the socket should be removed here
// receiving all the data. In this case, the socket should be removed here
// as handle by onChannelReady_
// as handle by onChannelReady_
lk
.
lock
();
if
(
socket
->
isRemovable
())
if
(
socket
->
isRemovable
())
sockets
.
erase
(
channel
);
sockets
.
erase
(
channel
);
else
else
...
...
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