Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
d760499f
Commit
d760499f
authored
Aug 18, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netsync: check received packet sizes
parent
228182fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
modules/control/netsync.c
modules/control/netsync.c
+11
-10
No files found.
modules/control/netsync.c
View file @
d760499f
...
...
@@ -187,9 +187,11 @@ static void *Master(void *handle)
/* We received something */
struct
sockaddr_storage
from
;
unsigned
struct_size
=
sizeof
(
from
);
recvfrom
(
sys
->
fd
,
data
,
sizeof
(
data
),
0
,
(
struct
sockaddr
*
)
&
from
,
&
struct_size
);
socklen_t
fromlen
=
sizeof
(
from
);
if
(
recvfrom
(
sys
->
fd
,
data
,
8
,
0
,
(
struct
sockaddr
*
)
&
from
,
&
fromlen
)
<
8
)
continue
;
mtime_t
master_system
=
GetPcrSystem
(
sys
->
input
);
if
(
master_system
<
0
)
...
...
@@ -199,8 +201,8 @@ static void *Master(void *handle)
data
[
1
]
=
hton64
(
master_system
);
/* Reply to the sender */
sendto
(
sys
->
fd
,
data
,
sizeof
(
data
)
,
0
,
(
struct
sockaddr
*
)
&
from
,
struct_size
);
sendto
(
sys
->
fd
,
data
,
16
,
0
,
(
struct
sockaddr
*
)
&
from
,
fromlen
);
#if 0
/* not sure we need the client information to sync,
since we are the master anyway */
...
...
@@ -228,18 +230,17 @@ static void *Slave(void *handle)
goto
wait
;
/* Send clock request to the master */
data
[
0
]
=
hton64
(
system
);
const
mtime_t
send_date
=
mdate
();
if
(
send
(
sys
->
fd
,
data
,
sizeof
(
data
[
0
]),
0
)
<=
0
)
goto
wait
;
data
[
0
]
=
hton64
(
system
);
send
(
sys
->
fd
,
data
,
8
,
0
);
/* Don't block */
if
(
poll
(
&
ufd
,
1
,
sys
->
timeout
)
<=
0
)
continue
;
const
mtime_t
receive_date
=
mdate
();
if
(
recv
(
sys
->
fd
,
data
,
sizeof
(
data
),
0
)
<=
0
)
if
(
recv
(
sys
->
fd
,
data
,
16
,
0
)
<
16
)
goto
wait
;
const
mtime_t
master_date
=
ntoh64
(
data
[
0
]);
...
...
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