summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2006-04-02 23:55:15 +0000
committerMark Spencer <markster@digium.com>2006-04-02 23:55:15 +0000
commit8b53dd0b7eaae5e951125adaeb9b84579ab245b1 (patch)
tree1210df70261e84f11ad2f8fcaa8e2e83695ff566
parent77a48c62665320affb60fe1d57d2ff4939689f46 (diff)
Cleanup URI (when none is specified) and make sure threads are stand alone
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--http.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/http.c b/http.c
index 2cd168862..c52fb206c 100644
--- a/http.c
+++ b/http.c
@@ -49,7 +49,7 @@
#include "asterisk/config.h"
#define MAX_PREFIX 80
-#define DEFAULT_PREFIX "asterisk"
+#define DEFAULT_PREFIX "/asterisk"
struct ast_http_server_instance {
FILE *f;
@@ -455,6 +455,8 @@ static void *http_root(void *data)
int sinlen;
struct ast_http_server_instance *ser;
pthread_t launched;
+ pthread_attr_t attr;
+
for (;;) {
ast_wait_for_input(httpfd, -1);
sinlen = sizeof(sin);
@@ -469,7 +471,10 @@ static void *http_root(void *data)
ser->fd = fd;
memcpy(&ser->requestor, &sin, sizeof(ser->requestor));
if ((ser->f = fdopen(ser->fd, "w+"))) {
- if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) {
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ if (ast_pthread_create(&launched, &attr, ast_httpd_helper_thread, ser)) {
ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
fclose(ser->f);
free(ser);