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
5c45fab3
Commit
5c45fab3
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
msgpack: avoid copy during packing
Change-Id: I651cf8f4c8bc08367e90f98a2108cdabf6c53c25
parent
b34cd486
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ice_transport.cpp
+7
-8
7 additions, 8 deletions
src/ice_transport.cpp
src/jamidht/connectionmanager.cpp
+5
-5
5 additions, 5 deletions
src/jamidht/connectionmanager.cpp
with
12 additions
and
13 deletions
src/ice_transport.cpp
+
7
−
8
View file @
5c45fab3
...
...
@@ -1272,13 +1272,13 @@ IceTransport::packIceMsg(uint8_t version) const
if
(
not
isInitialized
())
return
{};
std
::
stringstream
ss
;
msgpack
::
sbuffer
buffer
;
if
(
version
==
1
)
{
msgpack
::
pack
(
ss
,
version
);
msgpack
::
pack
(
ss
,
std
::
make_pair
(
pimpl_
->
local_ufrag_
,
pimpl_
->
local_pwd_
));
msgpack
::
pack
(
ss
,
static_cast
<
uint8_t
>
(
pimpl_
->
component_count_
));
msgpack
::
pack
(
buffer
,
version
);
msgpack
::
pack
(
buffer
,
std
::
make_pair
(
pimpl_
->
local_ufrag_
,
pimpl_
->
local_pwd_
));
msgpack
::
pack
(
buffer
,
static_cast
<
uint8_t
>
(
pimpl_
->
component_count_
));
for
(
unsigned
i
=
0
;
i
<
pimpl_
->
component_count_
;
i
++
)
msgpack
::
pack
(
ss
,
getLocalCandidates
(
i
));
msgpack
::
pack
(
buffer
,
getLocalCandidates
(
i
));
}
else
{
SDP
sdp
;
sdp
.
ufrag
=
pimpl_
->
local_ufrag_
;
...
...
@@ -1288,10 +1288,9 @@ IceTransport::packIceMsg(uint8_t version) const
sdp
.
candidates
.
reserve
(
sdp
.
candidates
.
size
()
+
candidates
.
size
());
sdp
.
candidates
.
insert
(
sdp
.
candidates
.
end
(),
candidates
.
begin
(),
candidates
.
end
());
}
msgpack
::
pack
(
ss
,
sdp
);
msgpack
::
pack
(
buffer
,
sdp
);
}
auto
str
(
ss
.
str
());
return
std
::
vector
<
uint8_t
>
(
str
.
begin
(),
str
.
end
());
return
std
::
vector
<
uint8_t
>
(
buffer
.
data
(),
buffer
.
data
()
+
buffer
.
size
());
}
bool
...
...
This diff is collapsed.
Click to expand it.
src/jamidht/connectionmanager.cpp
+
5
−
5
View file @
5c45fab3
...
...
@@ -488,9 +488,9 @@ ConnectionManager::Impl::sendChannelRequest(std::shared_ptr<MultiplexedSocket>&
val
.
name
=
channelSock
->
name
();
val
.
state
=
ChannelRequestState
::
REQUEST
;
val
.
channel
=
channelSock
->
channel
();
std
::
stringstream
ss
;
msgpack
::
pack
(
ss
,
val
);
auto
toSend
=
ss
.
str
();
msgpack
::
sbuffer
buffer
(
256
)
;
msgpack
::
pack
(
buffer
,
val
);
sock
->
setOnChannelReady
(
channelSock
->
channel
(),
[
channelSock
,
deviceId
,
vid
,
w
=
weak
()]()
{
if
(
auto
shared
=
w
.
lock
())
{
if
(
auto
cb
=
shared
->
getPendingCallback
({
deviceId
,
vid
}))
...
...
@@ -499,8 +499,8 @@ ConnectionManager::Impl::sendChannelRequest(std::shared_ptr<MultiplexedSocket>&
});
std
::
error_code
ec
;
int
res
=
sock
->
write
(
CONTROL_CHANNEL
,
reinterpret_cast
<
const
uint8_t
*>
(
&
toSend
[
0
]
),
toSend
.
size
(),
reinterpret_cast
<
const
uint8_t
*>
(
buffer
.
data
()
),
buffer
.
size
(),
ec
);
if
(
res
<
0
)
{
// TODO check if we should handle errors here
...
...
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