Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
8942735a
Commit
8942735a
authored
Jul 07, 2004
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* netsync module no longer IPv4-specific
parent
3f2e13bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
25 deletions
+20
-25
modules/control/netsync.c
modules/control/netsync.c
+20
-25
No files found.
modules/control/netsync.c
View file @
8942735a
...
...
@@ -147,31 +147,28 @@ static void Run( intf_thread_t *p_intf )
#define MAX_MSG_LENGTH (2 * sizeof(int64_t))
vlc_bool_t
b_master
=
config_GetInt
(
p_intf
,
"netsync-master"
);
char
*
psz_master
=
config_GetPsz
(
p_intf
,
"netsync-master-ip"
);
struct
sockaddr_in
master_addr
;
char
*
psz_master
;
char
p_data
[
MAX_MSG_LENGTH
];
int
i_socket
;
if
(
!
psz_master
||
inet_addr
(
psz_master
)
==
INADDR_NONE
)
if
(
!
b_master
)
{
if
(
!
b_master
)
psz_master
=
config_GetPsz
(
p_intf
,
"netsync-master-ip"
);
if
(
psz_master
==
NULL
)
{
if
(
psz_master
)
free
(
psz_master
);
msg_Err
(
p_intf
,
"invalid master address."
);
msg_Err
(
p_intf
,
"master address not specified"
);
return
;
}
if
(
!
psz_master
)
psz_master
=
strdup
(
""
);
}
memset
(
&
master_addr
,
0
,
sizeof
(
struct
sockaddr_in
)
);
master_addr
.
sin_family
=
AF_INET
;
master_addr
.
sin_port
=
htons
(
(
uint16_t
)
NETSYNC_PORT_MASTER
);
master_addr
.
sin_addr
.
s_addr
=
inet_addr
(
psz_master
);
free
(
psz_master
);
i_socket
=
net_OpenUDP
(
p_intf
,
NULL
,
b_master
?
NETSYNC_PORT_MASTER
:
NETSYNC_PORT_SLAVE
,
b_master
?
NULL
:
psz_master
,
b_master
?
0
:
NETSYNC_PORT_MASTER
);
i_socket
=
net_OpenUDP
(
p_intf
,
NULL
,
b_master
?
NETSYNC_PORT_MASTER
:
NETSYNC_PORT_SLAVE
,
NULL
,
0
);
if
(
!
b_master
)
free
(
psz_master
);
if
(
i_socket
<
0
)
{
msg_Err
(
p_intf
,
"failed opening UDP socket."
);
...
...
@@ -218,7 +215,7 @@ static void Run( intf_thread_t *p_intf )
if
(
b_master
)
{
struct
sockaddr_
in
from
;
struct
sockaddr_
storage
from
;
mtime_t
i_date
,
i_clockref
,
i_master_clockref
;
int
i_struct_size
,
i_read
,
i_ret
;
...
...
@@ -233,12 +230,10 @@ static void Run( intf_thread_t *p_intf )
}
/* We received something */
i_struct_size
=
sizeof
(
struct
sockaddr_in
);
i_struct_size
=
sizeof
(
from
);
i_read
=
recvfrom
(
i_socket
,
p_data
,
MAX_MSG_LENGTH
,
0
,
(
struct
sockaddr
*
)
&
from
,
&
i_struct_size
);
from
.
sin_port
=
htons
(
(
uint16_t
)
NETSYNC_PORT_SLAVE
);
i_clockref
=
ntoh64
(
*
(
int64_t
*
)
p_data
);
i_date
=
mdate
();
...
...
@@ -249,11 +244,13 @@ static void Run( intf_thread_t *p_intf )
/* Reply to the sender */
sendto
(
i_socket
,
p_data
,
2
*
sizeof
(
int64_t
),
0
,
(
struct
sockaddr
*
)
&
from
,
sizeof
(
struct
sockaddr_in
)
);
(
struct
sockaddr
*
)
&
from
,
i_struct_size
);
msg_Dbg
(
p_intf
,
"Master clockref: "
I64Fd
" -> "
I64Fd
", from %s "
"(date: "
I64Fd
")"
,
i_clockref
,
i_master_clockref
,
inet_ntoa
(
from
.
sin_addr
),
i_date
);
"(date: "
I64Fd
")"
,
i_clockref
,
i_master_clockref
,
from
.
ss_family
==
AF_INET
?
inet_ntoa
(((
struct
sockaddr_in
*
)
&
from
)
->
sin_addr
)
:
"non-IPv4"
,
i_date
);
}
else
{
...
...
@@ -266,9 +263,7 @@ static void Run( intf_thread_t *p_intf )
*
(
int64_t
*
)
p_data
=
hton64
(
i_clockref
);
i_send_date
=
mdate
();
i_sent
=
sendto
(
i_socket
,
p_data
,
sizeof
(
int64_t
),
0
,
(
struct
sockaddr
*
)
&
master_addr
,
sizeof
(
struct
sockaddr_in
)
);
i_sent
=
send
(
i_socket
,
p_data
,
sizeof
(
int64_t
),
0
);
if
(
i_sent
<=
0
)
{
/* Wait a bit */
...
...
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