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
a916d7be
Commit
a916d7be
authored
Aug 17, 2014
by
Hannes Domani
Committed by
Jean-Baptiste Kempf
Aug 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: reactivate vlclua_net_poll() on windows
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
558e6b78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
modules/lua/libs/net.c
modules/lua/libs/net.c
+37
-2
modules/lua/vlc.h
modules/lua/vlc.h
+0
-2
No files found.
modules/lua/libs/net.c
View file @
a916d7be
...
...
@@ -312,7 +312,6 @@ static int vlclua_net_recv( lua_State *L )
return
1
;
}
#ifndef _WIN32
/*****************************************************************************
*
*****************************************************************************/
...
...
@@ -380,6 +379,7 @@ static int vlclua_fd_open( lua_State *L )
}
*/
#ifndef _WIN32
static
int
vlclua_fd_write
(
lua_State
*
L
)
{
int
fd
=
vlclua_fd_get
(
L
,
luaL_checkint
(
L
,
1
)
);
...
...
@@ -492,8 +492,8 @@ static const luaL_Reg vlclua_net_intf_reg[] = {
{
"close"
,
vlclua_net_close
},
{
"send"
,
vlclua_net_send
},
{
"recv"
,
vlclua_net_recv
},
#ifndef _WIN32
{
"poll"
,
vlclua_net_poll
},
#ifndef _WIN32
{
"read"
,
vlclua_fd_read
},
{
"write"
,
vlclua_fd_write
},
#endif
...
...
@@ -521,11 +521,40 @@ static void luaopen_net_intf( lua_State *L )
lua_setfield
(
L
,
-
2
,
"net"
);
}
#ifdef _WIN32
static
int
vlc_socket_pair
(
int
fds
[
2
]
)
{
struct
sockaddr_in
inaddr
;
struct
sockaddr
addr
;
SOCKET
lst
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
memset
(
&
inaddr
,
0
,
sizeof
(
inaddr
)
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
inaddr
.
sin_family
=
AF_INET
;
inaddr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
inaddr
.
sin_port
=
0
;
int
yes
=
1
;
setsockopt
(
lst
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
yes
,
sizeof
(
yes
)
);
bind
(
lst
,
(
struct
sockaddr
*
)
&
inaddr
,
sizeof
(
inaddr
)
);
listen
(
lst
,
1
);
int
len
=
sizeof
(
inaddr
);
getsockname
(
lst
,
&
addr
,
&
len
);
fds
[
0
]
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
connect
(
fds
[
0
],
&
addr
,
len
);
fds
[
1
]
=
accept
(
lst
,
0
,
0
);
closesocket
(
lst
);
return
0
;
}
#endif
int
vlclua_fd_init
(
lua_State
*
L
,
vlclua_dtable_t
*
dt
)
{
#ifndef _WIN32
if
(
vlc_pipe
(
dt
->
fd
)
)
return
-
1
;
#else
if
(
vlc_socket_pair
(
dt
->
fd
)
)
return
-
1
;
#endif
dt
->
fdv
=
NULL
;
dt
->
fdc
=
0
;
...
...
@@ -539,6 +568,9 @@ void vlclua_fd_interrupt( vlclua_dtable_t *dt )
#ifndef _WIN32
close
(
dt
->
fd
[
1
]
);
dt
->
fd
[
1
]
=
-
1
;
#else
closesocket
(
dt
->
fd
[
0
]
);
dt
->
fd
[
0
]
=
-
1
;
#endif
}
...
...
@@ -553,5 +585,8 @@ void vlclua_fd_cleanup( vlclua_dtable_t *dt )
if
(
dt
->
fd
[
1
]
!=
-
1
)
close
(
dt
->
fd
[
1
]
);
close
(
dt
->
fd
[
0
]
);
#else
if
(
dt
->
fd
[
0
]
!=
-
1
)
closesocket
(
dt
->
fd
[
0
]
);
#endif
}
modules/lua/vlc.h
View file @
a916d7be
...
...
@@ -171,9 +171,7 @@ typedef struct
{
int
*
fdv
;
unsigned
fdc
;
#ifndef _WIN32
int
fd
[
2
];
#endif
}
vlclua_dtable_t
;
int
vlclua_fd_init
(
lua_State
*
,
vlclua_dtable_t
*
);
...
...
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