Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
tsn-measures
Commits
a20f85ef
Commit
a20f85ef
authored
May 26, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add socket option for timestamps
parent
3d857a59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+14
-10
No files found.
packet-exchange/src/send_packet.c
View file @
a20f85ef
...
...
@@ -54,7 +54,7 @@ static size_t tx_buffer_len = sizeof(tx_buffer);
static
int
fd
;
static
int
so_timestamping_flags
=
SOF_TIMESTAMPING_RX_SOFTWARE
|
SOF_TIMESTAMPING_TX_SOFTWARE
;
SOF_TIMESTAMPING_RX_SOFTWARE
|
SOF_TIMESTAMPING_TX_SOFTWARE
|
SOF_TIMESTAMPING_SOFTWARE
|
SOF_TIMESTAMPING_RAW_HARDWARE
;
// Sets the interface
static
int
set_if
(
char
*
network_if
)
{
...
...
@@ -165,12 +165,15 @@ void send_udp_packet(int use_etf, int use_timestamps, uint64_t txtime,
if
(
sendmsgerr
<
0
)
error
(
EXIT_FAILURE
,
errno
,
"sendmsg failed, ret value: %d
\n
"
,
sendmsgerr
);
pollerr
=
poll
(
&
poll_fd
,
1
,
0
);
// If the poll revents containts a POLLERR flag
if
(
pollerr
==
1
&&
(
poll_fd
.
revents
&
POLLERR
))
{
process_socket_error_queue
(
fd
);
}
else
if
(
use_timestamps
)
{
process_timestamps
(
fd
);
for
(
int
i
=
0
;
i
<
(
use_timestamps
+
1
);
i
++
)
{
printf
(
"Polling...
\n
"
);
pollerr
=
poll
(
&
poll_fd
,
1
,
0
);
// If the poll revents containts a POLLERR flag
if
(
pollerr
==
1
&&
(
poll_fd
.
revents
&
POLLERR
))
{
process_socket_error_queue
(
fd
);
}
else
if
(
use_timestamps
)
{
process_timestamps
(
fd
);
}
}
}
...
...
@@ -192,11 +195,12 @@ static void process_timestamps(int sock) {
msg
.
msg_control
=
&
control
;
msg
.
msg_controllen
=
sizeof
(
control
);
if
(
recvmsg
(
sock
,
&
msg
,
0
)
==
-
1
)
{
if
(
recvmsg
(
sock
,
&
msg
,
MSG_DONTWAIT
)
==
-
1
)
{
fprintf
(
stderr
,
"recvmsg failed"
);
exit
(
EXIT_FAILURE
);
}
print_timestamps
(
&
msg
);
else
{
print_timestamps
(
&
msg
);
}
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment