mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
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
This commit is contained in:
9
http.c
9
http.c
@@ -49,7 +49,7 @@
|
|||||||
#include "asterisk/config.h"
|
#include "asterisk/config.h"
|
||||||
|
|
||||||
#define MAX_PREFIX 80
|
#define MAX_PREFIX 80
|
||||||
#define DEFAULT_PREFIX "asterisk"
|
#define DEFAULT_PREFIX "/asterisk"
|
||||||
|
|
||||||
struct ast_http_server_instance {
|
struct ast_http_server_instance {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@@ -455,6 +455,8 @@ static void *http_root(void *data)
|
|||||||
int sinlen;
|
int sinlen;
|
||||||
struct ast_http_server_instance *ser;
|
struct ast_http_server_instance *ser;
|
||||||
pthread_t launched;
|
pthread_t launched;
|
||||||
|
pthread_attr_t attr;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ast_wait_for_input(httpfd, -1);
|
ast_wait_for_input(httpfd, -1);
|
||||||
sinlen = sizeof(sin);
|
sinlen = sizeof(sin);
|
||||||
@@ -469,7 +471,10 @@ static void *http_root(void *data)
|
|||||||
ser->fd = fd;
|
ser->fd = fd;
|
||||||
memcpy(&ser->requestor, &sin, sizeof(ser->requestor));
|
memcpy(&ser->requestor, &sin, sizeof(ser->requestor));
|
||||||
if ((ser->f = fdopen(ser->fd, "w+"))) {
|
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));
|
ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
|
||||||
fclose(ser->f);
|
fclose(ser->f);
|
||||||
free(ser);
|
free(ser);
|
||||||
|
Reference in New Issue
Block a user