Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
savoirfairelinux
jami-daemon
Commits
ad41cd62
Unverified
Commit
ad41cd62
authored
4 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
mxsock: replace async by a thread and fix shutdown
Change-Id: Ie5c14606c01c5c277b7939889eb035caa6607b52
parent
84cf2b44
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/jamidht/multiplexed_socket.cpp
+6
-6
6 additions, 6 deletions
src/jamidht/multiplexed_socket.cpp
with
6 additions
and
6 deletions
src/jamidht/multiplexed_socket.cpp
+
6
−
6
View file @
ad41cd62
...
...
@@ -45,14 +45,13 @@ public:
:
parent_
(
parent
)
,
deviceId
(
deviceId
)
,
endpoint
(
std
::
move
(
endpoint
))
,
eventLoop
Fut_
{
std
::
async
(
std
::
launch
::
async
,
[
this
]
{
,
eventLoop
Thread_
{
[
this
]
{
try
{
stop
.
store
(
false
);
eventLoop
();
}
catch
(
const
std
::
exception
&
e
)
{
JAMI_ERR
()
<<
"[CNX] peer connection event loop failure: "
<<
e
.
what
();
}
}
)
}
}}
{}
~
Impl
()
...
...
@@ -69,6 +68,7 @@ public:
}
sockets
.
clear
();
}
eventLoopThread_
.
join
();
}
void
shutdown
()
...
...
@@ -129,8 +129,8 @@ public:
std
::
map
<
uint16_t
,
onChannelReadyCb
>
channelCbs
{};
// Main loop to parse incoming packets
std
::
future
<
void
>
eventLoopFut_
{
};
std
::
atomic_bool
stop
{};
std
::
atomic_bool
stop
{
false
};
std
::
thread
eventLoopThread_
{};
// Multiplexed available datas
std
::
map
<
uint16_t
,
std
::
unique_ptr
<
ChannelInfo
>>
channelDatas_
{};
...
...
@@ -197,7 +197,7 @@ MultiplexedSocket::Impl::handleControlPacket(const std::vector<uint8_t>&& pkt)
size_t
off
=
0
;
while
(
off
!=
pkt
.
size
())
{
msgpack
::
unpacked
result
;
msgpack
::
unpack
(
result
,
(
const
char
*
)
pkt
.
data
(),
pkt
.
size
(),
off
);
msgpack
::
unpack
(
result
,
(
const
char
*
)
pkt
.
data
(),
pkt
.
size
(),
off
);
auto
req
=
result
.
get
().
as
<
ChannelRequest
>
();
if
(
req
.
state
==
ChannelRequestState
::
ACCEPT
)
{
std
::
lock_guard
<
std
::
mutex
>
lkSockets
(
socketsMutex
);
...
...
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