From ecc49089c697a2cb7331358def5ce7640fae65bf Mon Sep 17 00:00:00 2001 From: David Troy Date: Mon, 3 Apr 2006 18:14:45 +0000 Subject: git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@73 f02b47b9-160a-0410-81a6-dc3441afb0ec --- Makefile | 3 +-- src/astmanproxy.c | 11 +++-------- src/http.c | 5 ++--- src/include/astmanproxy.h | 1 - 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 242da16..4f7e50c 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,7 @@ DEFINES+='-DMDIR="$(MODDIR)"' '-DPDIR="$(PERMDIR)"' '-DPFILE="$(PERMFILE)"' VPATH = src # Add -g below for debug/GDB symbols -#CFLAGS+= $(DEFINES) -Wall -O2 -dynamic -D_REENTRANT -fPIC -CFLAGS+= $(DEFINES) -Wall -O2 -D_REENTRANT -fPIC -Isrc/include -I/usr/include/openssl -I- +CFLAGS+= $(DEFINES) -g -Wall -O2 -D_REENTRANT -fPIC -Isrc/include -I/usr/include/openssl -I- # For printing only SRCS := $(MODS:%=%.c) diff --git a/src/astmanproxy.c b/src/astmanproxy.c index 853b8bf..457a3bf 100644 --- a/src/astmanproxy.c +++ b/src/astmanproxy.c @@ -181,12 +181,8 @@ int WriteClients(struct message *m) { } } else c->output->write(c, m); - if ( c->input->autodisconnect && c->input->autodisconnect() ) { - d = c; /* session to disconnect */ - c = c->next; - destroy_session(d); - continue; - } + if ( c->input->autodisconnect && c->input->autodisconnect() ) + c->dead = 1; } c = c->next; } @@ -298,7 +294,7 @@ void *session_do(struct mansession *s) destroy_session(s); if (debug) - debugmsg("Exiting session_do thread"); + debugmsg("--- exiting session_do thread ---"); pthread_exit(NULL); return NULL; } @@ -584,7 +580,6 @@ static void *accept_thread() s->fd = as; SetIOHandlers(s, pc.inputformat, pc.outputformat); s->autofilter = pc.autofilter; - s->inputcomplete = 0; s->server = NULL; pthread_mutex_lock(&sessionlock); diff --git a/src/http.c b/src/http.c index 3b271b9..91c3de0 100644 --- a/src/http.c +++ b/src/http.c @@ -66,8 +66,8 @@ int _read(struct mansession *s, struct message *m) { char line[MAX_LEN], method[10], formdata[MAX_LEN], header[MAX_LEN]; int res, clength = 0; - if (s->inputcomplete) - return 0; + if (s->dead) + return -1; memset(method, 0, sizeof method); memset(formdata, 0, sizeof formdata); @@ -107,7 +107,6 @@ int _read(struct mansession *s, struct message *m) { BuildHTTPHeader(header); pthread_mutex_lock(&s->lock); - s->inputcomplete = 1; ast_carefulwrite(s->fd, header, strlen(header), s->writetimeout); pthread_mutex_unlock(&s->lock); debugmsg("header: %s", header); diff --git a/src/include/astmanproxy.h b/src/include/astmanproxy.h index 4068299..fc80412 100644 --- a/src/include/astmanproxy.h +++ b/src/include/astmanproxy.h @@ -96,7 +96,6 @@ struct mansession { struct iohandler *input; struct iohandler *output; int autofilter; - int inputcomplete; int authenticated; int connected; int dead; /* Whether we are dead */ -- cgit