Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
eadd66a4
Commit
eadd66a4
authored
10 years ago
by
Reynaldo H. Verdejo Pinochet
Browse files
Options
Downloads
Patches
Plain Diff
ffserver: reflow handle_connection()
Signed-off-by:
Reynaldo H. Verdejo Pinochet
<
reynaldo@osg.samsung.com
>
parent
7d3857b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ffserver.c
+13
-12
13 additions, 12 deletions
ffserver.c
with
13 additions
and
12 deletions
ffserver.c
+
13
−
12
View file @
eadd66a4
...
...
@@ -870,6 +870,7 @@ static void close_connection(HTTPContext *c)
static
int
handle_connection
(
HTTPContext
*
c
)
{
int
len
,
ret
;
uint8_t
*
ptr
;
switch
(
c
->
state
)
{
case
HTTPSTATE_WAIT_REQUEST
:
...
...
@@ -885,16 +886,16 @@ static int handle_connection(HTTPContext *c)
return
0
;
/* read the data */
read_loop:
len
=
recv
(
c
->
fd
,
c
->
buffer_ptr
,
1
,
0
);
if
(
!
(
len
=
recv
(
c
->
fd
,
c
->
buffer_ptr
,
1
,
0
)))
return
-
1
;
if
(
len
<
0
)
{
if
(
ff_neterrno
()
!=
AVERROR
(
EAGAIN
)
&&
ff_neterrno
()
!=
AVERROR
(
EINTR
))
return
-
1
;
}
else
if
(
len
==
0
)
{
return
-
1
;
}
else
{
break
;
}
/* search for end of request. */
uint8_t
*
ptr
;
c
->
buffer_ptr
+=
len
;
ptr
=
c
->
buffer_ptr
;
if
((
ptr
>=
c
->
buffer
+
2
&&
!
memcmp
(
ptr
-
2
,
"
\n\n
"
,
2
))
||
...
...
@@ -911,7 +912,7 @@ static int handle_connection(HTTPContext *c)
/* request too long: cannot do anything */
return
-
1
;
}
else
goto
read_loop
;
}
break
;
case
HTTPSTATE_SEND_HEADER
:
...
...
@@ -927,7 +928,8 @@ static int handle_connection(HTTPContext *c)
ff_neterrno
()
!=
AVERROR
(
EINTR
))
{
goto
close_connection
;
}
}
else
{
break
;
}
c
->
buffer_ptr
+=
len
;
if
(
c
->
stream
)
c
->
stream
->
bytes_served
+=
len
;
...
...
@@ -942,7 +944,6 @@ static int handle_connection(HTTPContext *c)
c
->
state
=
HTTPSTATE_SEND_DATA_HEADER
;
c
->
buffer_ptr
=
c
->
buffer_end
=
c
->
buffer
;
}
}
break
;
case
HTTPSTATE_SEND_DATA
:
...
...
@@ -994,7 +995,8 @@ static int handle_connection(HTTPContext *c)
ff_neterrno
()
!=
AVERROR
(
EINTR
))
{
goto
close_connection
;
}
}
else
{
break
;
}
c
->
buffer_ptr
+=
len
;
c
->
data_count
+=
len
;
if
(
c
->
buffer_ptr
>=
c
->
buffer_end
)
{
...
...
@@ -1002,7 +1004,6 @@ static int handle_connection(HTTPContext *c)
av_freep
(
&
c
->
pb_buffer
);
start_wait_request
(
c
,
1
);
}
}
break
;
case
RTSPSTATE_SEND_PACKET
:
if
(
c
->
poll_entry
->
revents
&
(
POLLERR
|
POLLHUP
))
{
...
...
@@ -1021,14 +1022,14 @@ static int handle_connection(HTTPContext *c)
av_freep
(
&
c
->
packet_buffer
);
return
-
1
;
}
}
else
{
break
;
}
c
->
packet_buffer_ptr
+=
len
;
if
(
c
->
packet_buffer_ptr
>=
c
->
packet_buffer_end
)
{
/* all the buffer was sent : wait for a new request */
av_freep
(
&
c
->
packet_buffer
);
c
->
state
=
RTSPSTATE_WAIT_REQUEST
;
}
}
break
;
case
HTTPSTATE_READY
:
/* nothing to do */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment