From d0d50a4ad760b52f5f479be0b3b5f12db3c67658 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Thu, 20 Mar 2003 17:21:54 +0000 Subject: Merge some of Mahmut's patches git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@666 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- manager.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'manager.c') diff --git a/manager.c b/manager.c index be1bb28fb..1b954c845 100755 --- a/manager.c +++ b/manager.c @@ -16,8 +16,11 @@ #include #include #include +#include +#include #include #include +#include #include #include #include @@ -432,6 +435,7 @@ static int process_message(struct mansession *s, struct message *m) struct manager_action *tmp = first_action; strncpy(action, get_header(m, "Action"), sizeof(action)); + ast_log( LOG_DEBUG, "Manager received command '%s'\n", action ); if (!strlen(action)) { send_error(s, "Missing action in request"); @@ -569,10 +573,13 @@ static void *accept_thread(void *ignore) struct sockaddr_in sin; int sinlen; struct mansession *s; + struct protoent *p; + int arg = 1; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + for (;;) { sinlen = sizeof(sin); as = accept(asock, &sin, &sinlen); @@ -580,6 +587,12 @@ static void *accept_thread(void *ignore) ast_log(LOG_NOTICE, "Accept returned -1: %s\n", strerror(errno)); continue; } + p = getprotobyname("tcp"); + if( p ) { + if( setsockopt(as, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) { + ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY mode: %s\n", strerror(errno)); + } + } s = malloc(sizeof(struct mansession)); if (!s) { ast_log(LOG_WARNING, "Failed to allocate management session: %s\n", strerror(errno)); -- cgit v1.2.3