diff options
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/main/manager.c b/main/manager.c index b8dbb1a04..0f7adf0c8 100644 --- a/main/manager.c +++ b/main/manager.c @@ -6591,10 +6591,9 @@ static void *session_do(void *data) struct mansession s = { .tcptls_session = data, }; - int flags; + int flags = 1; int res; struct ast_sockaddr ser_remote_address_tmp; - struct protoent *p; if (ast_atomic_fetchadd_int(&unauth_sessions, +1) >= authlimit) { fclose(ser->f); @@ -6614,14 +6613,8 @@ static void *session_do(void *data) /* here we set TCP_NODELAY on the socket to disable Nagle's algorithm. * This is necessary to prevent delays (caused by buffering) as we * write to the socket in bits and pieces. */ - p = getprotobyname("tcp"); - if (p) { - int arg = 1; - if( setsockopt(ser->fd, 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\nSome manager actions may be slow to respond.\n", strerror(errno)); - } - } else { - ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY, getprotobyname(\"tcp\") failed\nSome manager actions may be slow to respond.\n"); + if (setsockopt(ser->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &flags, sizeof(flags)) < 0) { + ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on manager connection: %s\n", strerror(errno)); } /* make sure socket is non-blocking */ |