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
21d5f46e
Commit
21d5f46e
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
IceTransport: cleanup
Change-Id: I5a8680332710a302fcbea03d2f6bb60a74e9ed61
parent
ecde63fd
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/ice_transport.cpp
+6
-12
6 additions, 12 deletions
src/ice_transport.cpp
with
6 additions
and
12 deletions
src/ice_transport.cpp
+
6
−
12
View file @
21d5f46e
...
...
@@ -172,13 +172,7 @@ public:
std
::
atomic_bool
is_stopped_
{
false
};
struct
Packet
{
Packet
(
void
*
pkt
,
pj_size_t
size
)
:
data
{
reinterpret_cast
<
char
*>
(
pkt
),
reinterpret_cast
<
char
*>
(
pkt
)
+
size
}
{}
std
::
vector
<
char
>
data
{};
};
using
Packet
=
std
::
vector
<
uint8_t
>
;
struct
ComponentIO
{
...
...
@@ -1627,12 +1621,12 @@ IceTransport::recv(unsigned compId, unsigned char* buf, size_t len, std::error_c
}
auto
&
packet
=
io
.
queue
.
front
();
const
auto
count
=
std
::
min
(
len
,
packet
.
data
.
size
());
std
::
copy_n
(
packet
.
data
.
begin
(),
count
,
buf
);
if
(
count
==
packet
.
data
.
size
())
{
const
auto
count
=
std
::
min
(
len
,
packet
.
size
());
std
::
copy_n
(
packet
.
begin
(),
count
,
buf
);
if
(
count
==
packet
.
size
())
{
io
.
queue
.
pop_front
();
}
else
{
packet
.
data
.
erase
(
packet
.
data
.
begin
(),
packet
.
data
.
begin
()
+
count
);
packet
.
erase
(
packet
.
begin
(),
packet
.
begin
()
+
count
);
}
ec
.
clear
();
...
...
@@ -1658,7 +1652,7 @@ IceTransport::setOnRecv(unsigned compId, IceRecvCb cb)
if
(
io
.
recvCb
)
{
// Flush existing queue using the callback
for
(
const
auto
&
packet
:
io
.
queue
)
io
.
recvCb
((
uint8_t
*
)
packet
.
data
.
data
(),
packet
.
data
.
size
());
io
.
recvCb
((
uint8_t
*
)
packet
.
data
(),
packet
.
size
());
io
.
queue
.
clear
();
}
}
...
...
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