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
3956c4a6
Commit
3956c4a6
authored
Jan 12, 2016
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpd: simplify client destruction
parent
1348cb1c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
src/network/httpd.c
src/network/httpd.c
+10
-18
No files found.
src/network/httpd.c
View file @
3956c4a6
...
...
@@ -63,7 +63,7 @@
#define HTTPD_CL_BUFSIZE 10000
#endif
static
void
httpd_Client
Clean
(
httpd_client_t
*
cl
);
static
void
httpd_Client
Destroy
(
httpd_client_t
*
cl
);
static
void
httpd_AppendData
(
httpd_stream_t
*
stream
,
uint8_t
*
p_data
,
int
i_data
);
/* each host run in his own thread */
...
...
@@ -1033,14 +1033,10 @@ void httpd_HostDelete(httpd_host_t *host)
msg_Err
(
host
,
"url still registered: %s"
,
host
->
url
[
i
]
->
psz_url
);
for
(
int
i
=
0
;
i
<
host
->
i_client
;
i
++
)
{
httpd_client_t
*
cl
=
host
->
client
[
i
];
msg_Warn
(
host
,
"client still connected"
);
httpd_ClientClean
(
cl
);
TAB_REMOVE
(
host
->
i_client
,
host
->
client
,
cl
);
free
(
cl
);
i
--
;
/* TODO */
httpd_ClientDestroy
(
host
->
client
[
i
]);
}
TAB_CLEAN
(
host
->
i_client
,
host
->
client
);
vlc_tls_Delete
(
host
->
p_tls
);
net_ListenClose
(
host
->
fds
);
...
...
@@ -1118,9 +1114,8 @@ void httpd_UrlDelete(httpd_url_t *url)
/* TODO complete it */
msg_Warn
(
host
,
"force closing connections"
);
httpd_ClientClean
(
client
);
TAB_REMOVE
(
host
->
i_client
,
host
->
client
,
client
);
free
(
client
);
httpd_ClientDestroy
(
client
);
i
--
;
}
free
(
url
);
...
...
@@ -1221,20 +1216,18 @@ char* httpd_ServerIP(const httpd_client_t *cl, char *ip, int *port)
return
net_GetSockAddress
(
cl
->
fd
,
ip
,
port
)
?
NULL
:
ip
;
}
static
void
httpd_Client
Clean
(
httpd_client_t
*
cl
)
static
void
httpd_Client
Destroy
(
httpd_client_t
*
cl
)
{
if
(
cl
->
fd
>=
0
)
{
if
(
cl
->
p_tls
)
vlc_tls_SessionDelete
(
cl
->
p_tls
);
if
(
cl
->
p_tls
!=
NULL
)
vlc_tls_Close
(
cl
->
p_tls
);
else
net_Close
(
cl
->
fd
);
cl
->
fd
=
-
1
;
}
httpd_MsgClean
(
&
cl
->
answer
);
httpd_MsgClean
(
&
cl
->
query
);
free
(
cl
->
p_buffer
);
cl
->
p_buffer
=
NULL
;
free
(
cl
)
;
}
static
httpd_client_t
*
httpd_ClientNew
(
int
fd
,
vlc_tls_t
*
p_tls
,
mtime_t
now
)
...
...
@@ -1744,10 +1737,9 @@ static void httpdLoop(httpd_host_t *host)
(
cl
->
i_state
==
HTTPD_CLIENT_DEAD
||
(
cl
->
i_activity_timeout
>
0
&&
cl
->
i_activity_date
+
cl
->
i_activity_timeout
<
now
))))
{
httpd_ClientClean
(
cl
);
TAB_REMOVE
(
host
->
i_client
,
host
->
client
,
cl
);
free
(
cl
);
i_client
--
;
httpd_ClientDestroy
(
cl
);
continue
;
}
...
...
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