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
62720ebc
Commit
62720ebc
authored
Sep 25, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix use of HTTPd from multiple instances in same process
parent
278a69e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
60 deletions
+19
-60
src/libvlc.h
src/libvlc.h
+0
-1
src/network/httpd.c
src/network/httpd.c
+19
-59
No files found.
src/libvlc.h
View file @
62720ebc
...
...
@@ -188,7 +188,6 @@ typedef struct libvlc_priv_t
vlc_mutex_t
ml_lock
;
///< Mutex for ML creation
vlm_t
*
p_vlm
;
///< the VLM singleton (or NULL)
vlc_object_t
*
p_dialog_provider
;
///< dialog provider
httpd_t
*
p_httpd
;
///< HTTP daemon (src/network/httpd.c)
#ifdef ENABLE_SOUT
sap_handler_t
*
p_sap
;
///< SAP SDP advertiser
#endif
...
...
src/network/httpd.c
View file @
62720ebc
...
...
@@ -68,22 +68,11 @@
static
void
httpd_ClientClean
(
httpd_client_t
*
cl
);
struct
httpd_t
{
VLC_COMMON_MEMBERS
int
i_host
;
httpd_host_t
**
host
;
};
/* each host run in his own thread */
struct
httpd_host_t
{
VLC_COMMON_MEMBERS
httpd_t
*
httpd
;
/* ref count */
unsigned
i_ref
;
...
...
@@ -1030,45 +1019,31 @@ httpd_host_t *vlc_rtsp_HostNew( vlc_object_t *p_this )
return
httpd_HostCreate
(
p_this
,
"rtsp-host"
,
"rtsp-port"
,
NULL
);
}
static
vlc_mutex_t
httpd_mutex
=
VLC_STATIC_MUTEX
;
static
struct
httpd_t
{
vlc_mutex_t
mutex
;
httpd_host_t
**
host
;
int
i_host
;
}
httpd
=
{
VLC_STATIC_MUTEX
,
NULL
,
0
};
static
httpd_host_t
*
httpd_HostCreate
(
vlc_object_t
*
p_this
,
const
char
*
hostvar
,
const
char
*
portvar
,
vlc_tls_creds_t
*
p_tls
)
{
httpd_t
*
httpd
;
httpd_host_t
*
host
;
int
i
;
/* to be sure to avoid multiple creation */
vlc_mutex_lock
(
&
httpd_mutex
);
httpd
=
libvlc_priv
(
p_this
->
p_libvlc
)
->
p_httpd
;
if
(
httpd
==
NULL
)
{
msg_Info
(
p_this
,
"creating httpd"
);
httpd
=
(
httpd_t
*
)
vlc_custom_create
(
p_this
,
sizeof
(
*
httpd
),
"http server"
);
if
(
httpd
==
NULL
)
{
vlc_mutex_unlock
(
&
httpd_mutex
);
return
NULL
;
}
httpd
->
i_host
=
0
;
httpd
->
host
=
NULL
;
libvlc_priv
(
p_this
->
p_libvlc
)
->
p_httpd
=
httpd
;
}
vlc_mutex_lock
(
&
httpd
.
mutex
);
/* verify if it already exist */
for
(
i
=
httpd
->
i_host
-
1
;
i
>=
0
;
i
--
)
for
(
i
nt
i
=
0
;
i
<
httpd
.
i_host
;
i
++
)
{
host
=
httpd
->
host
[
i
];
host
=
httpd
.
host
[
i
];
/* cannot mix TLS and non-TLS hosts */
if
(
(
h
ttpd
->
host
[
i
]
->
p_tls
!=
NULL
)
!=
(
p_tls
!=
NULL
)
)
if
(
(
h
ost
->
p_tls
!=
NULL
)
!=
(
p_tls
!=
NULL
)
)
continue
;
/* Increase existing matching host reference count.
...
...
@@ -1079,7 +1054,7 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
host
->
i_ref
++
;
vlc_mutex_unlock
(
&
host
->
lock
);
vlc_mutex_unlock
(
&
httpd
_
mutex
);
vlc_mutex_unlock
(
&
httpd
.
mutex
);
if
(
p_tls
!=
NULL
)
vlc_tls_ServerDelete
(
p_tls
);
return
host
;
...
...
@@ -1093,7 +1068,6 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
if
(
host
==
NULL
)
goto
error
;
host
->
httpd
=
httpd
;
vlc_mutex_init
(
&
host
->
lock
);
vlc_cond_init
(
&
host
->
wait
);
host
->
i_ref
=
1
;
...
...
@@ -1130,18 +1104,13 @@ static httpd_host_t *httpd_HostCreate( vlc_object_t *p_this,
}
/* now add it to httpd */
TAB_APPEND
(
httpd
->
i_host
,
httpd
->
host
,
host
);
vlc_mutex_unlock
(
&
httpd
_
mutex
);
TAB_APPEND
(
httpd
.
i_host
,
httpd
.
host
,
host
);
vlc_mutex_unlock
(
&
httpd
.
mutex
);
return
host
;
error:
if
(
httpd
->
i_host
<=
0
)
{
libvlc_priv
(
httpd
->
p_libvlc
)
->
p_httpd
=
NULL
;
vlc_object_release
(
httpd
);
}
vlc_mutex_unlock
(
&
httpd_mutex
);
vlc_mutex_unlock
(
&
httpd
.
mutex
);
if
(
host
!=
NULL
)
{
...
...
@@ -1160,11 +1129,10 @@ error:
/* delete a host */
void
httpd_HostDelete
(
httpd_host_t
*
host
)
{
httpd_t
*
httpd
=
host
->
httpd
;
int
i
;
bool
delete
=
false
;
vlc_mutex_lock
(
&
httpd
_
mutex
);
vlc_mutex_lock
(
&
httpd
.
mutex
);
vlc_mutex_lock
(
&
host
->
lock
);
host
->
i_ref
--
;
...
...
@@ -1177,11 +1145,11 @@ void httpd_HostDelete( httpd_host_t *host )
if
(
!
delete
)
{
/* still used */
vlc_mutex_unlock
(
&
httpd
_
mutex
);
vlc_mutex_unlock
(
&
httpd
.
mutex
);
msg_Dbg
(
host
,
"httpd_HostDelete: host still in use"
);
return
;
}
TAB_REMOVE
(
httpd
->
i_host
,
httpd
->
host
,
host
);
TAB_REMOVE
(
httpd
.
i_host
,
httpd
.
host
,
host
);
vlc_object_kill
(
host
);
vlc_join
(
host
->
thread
,
NULL
);
...
...
@@ -1210,15 +1178,7 @@ void httpd_HostDelete( httpd_host_t *host )
vlc_cond_destroy
(
&
host
->
wait
);
vlc_mutex_destroy
(
&
host
->
lock
);
vlc_object_release
(
host
);
if
(
httpd
->
i_host
<=
0
)
{
msg_Dbg
(
httpd
,
"no hosts left, stopping httpd"
);
libvlc_priv
(
httpd
->
p_libvlc
)
->
p_httpd
=
NULL
;
vlc_object_release
(
httpd
);
}
vlc_mutex_unlock
(
&
httpd_mutex
);
vlc_mutex_unlock
(
&
httpd
.
mutex
);
}
/* register a new url */
...
...
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