repositories
/
deb_shairplay.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix #23 on issue tracker.
[deb_shairplay.git]
/
src
/
lib
/
httpd.c
diff --git
a/src/lib/httpd.c
b/src/lib/httpd.c
index dfd3d6b6a2a167587ef02e1d77e8cd23b16d695b..f081c5e65cc74eb4c10f8ac7ad2818a50cffc73f 100644
(file)
--- a/
src/lib/httpd.c
+++ b/
src/lib/httpd.c
@@
-36,8
+36,6
@@
struct httpd_s {
logger_t *logger;
httpd_callbacks_t callbacks;
logger_t *logger;
httpd_callbacks_t callbacks;
- int use_rtsp;
-
int max_connections;
int open_connections;
http_connection_t *connections;
int max_connections;
int open_connections;
http_connection_t *connections;
@@
-54,7
+52,7
@@
struct httpd_s {
};
httpd_t *
};
httpd_t *
-httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections
, int use_rtsp
)
+httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections)
{
httpd_t *httpd;
{
httpd_t *httpd;
@@
-68,7
+66,6
@@
httpd_init(logger_t *logger, httpd_callbacks_t *callbacks, int max_connections,
return NULL;
}
return NULL;
}
- httpd->use_rtsp = !!use_rtsp;
httpd->max_connections = max_connections;
httpd->connections = calloc(max_connections, sizeof(http_connection_t));
if (!httpd->connections) {
httpd->max_connections = max_connections;
httpd->connections = calloc(max_connections, sizeof(http_connection_t));
if (!httpd->connections) {
@@
-240,7
+237,8
@@
httpd_thread(void *arg)
continue;
}
}
continue;
}
}
- if (httpd->server_fd6 != -1 && FD_ISSET(httpd->server_fd6, &rfds)) {
+ if (httpd->open_connections < httpd->max_connections &&
+ httpd->server_fd6 != -1 && FD_ISSET(httpd->server_fd6, &rfds)) {
ret = httpd_accept_connection(httpd, httpd->server_fd6, 1);
if (ret == -1) {
break;
ret = httpd_accept_connection(httpd, httpd->server_fd6, 1);
if (ret == -1) {
break;
@@
-260,7
+258,7
@@
httpd_thread(void *arg)
/* If not in the middle of request, allocate one */
if (!connection->request) {
/* If not in the middle of request, allocate one */
if (!connection->request) {
- connection->request = http_request_init(
httpd->use_rtsp
);
+ connection->request = http_request_init();
assert(connection->request);
}
assert(connection->request);
}
@@
-307,10
+305,17
@@
httpd_thread(void *arg)
}
written += ret;
}
}
written += ret;
}
+
+ if (http_response_get_disconnect(response)) {
+ logger_log(httpd->logger, LOGGER_INFO, "Disconnecting on software request");
+ httpd_remove_connection(httpd, connection);
+ }
} else {
logger_log(httpd->logger, LOGGER_INFO, "Didn't get response");
}
http_response_destroy(response);
} else {
logger_log(httpd->logger, LOGGER_INFO, "Didn't get response");
}
http_response_destroy(response);
+ } else {
+ logger_log(httpd->logger, LOGGER_DEBUG, "Request not complete, waiting for more data...");
}
}
}
}
}
}