aboutsummaryrefslogtreecommitdiffstats
path: root/ffserver.c
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>2014-02-13 03:24:16 -0300
committerReynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>2014-02-14 14:31:41 -0300
commitba6186d6eb316029f0ab3ced89072dfab2282bf7 (patch)
tree43ac6ab3f550f8719ed2116fd7b35c95f98ec10f /ffserver.c
parent5df2a502f2147c16b6151e8c36ddd682b91ac8ea (diff)
downloadffmpeg-ba6186d6eb316029f0ab3ced89072dfab2282bf7.tar.gz
ffserver: factor out connection closing from handler
Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
Diffstat (limited to 'ffserver.c')
-rw-r--r--ffserver.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/ffserver.c b/ffserver.c
index d57aa315f5..f6fb082406 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -1003,9 +1003,7 @@ static int handle_connection(HTTPContext *c)
if (len < 0) {
if (ff_neterrno() != AVERROR(EAGAIN) &&
ff_neterrno() != AVERROR(EINTR)) {
- /* error : close connection */
- av_freep(&c->pb_buffer);
- return -1;
+ goto close_connection;
}
} else {
c->buffer_ptr += len;
@@ -1063,10 +1061,8 @@ static int handle_connection(HTTPContext *c)
break;
case RTSPSTATE_SEND_REPLY:
- if (c->poll_entry->revents & (POLLERR | POLLHUP)) {
- av_freep(&c->pb_buffer);
- return -1;
- }
+ if (c->poll_entry->revents & (POLLERR | POLLHUP))
+ goto close_connection;
/* no need to write if no events */
if (!(c->poll_entry->revents & POLLOUT))
return 0;
@@ -1074,9 +1070,7 @@ static int handle_connection(HTTPContext *c)
if (len < 0) {
if (ff_neterrno() != AVERROR(EAGAIN) &&
ff_neterrno() != AVERROR(EINTR)) {
- /* error : close connection */
- av_freep(&c->pb_buffer);
- return -1;
+ goto close_connection;
}
} else {
c->buffer_ptr += len;
@@ -1121,6 +1115,10 @@ static int handle_connection(HTTPContext *c)
return -1;
}
return 0;
+
+close_connection:
+ av_freep(&c->pb_buffer);
+ return -1;
}
static int extract_rates(char *rates, int ratelen, const char *request)