summaryrefslogtreecommitdiff
path: root/main/manager.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-03-18 13:30:32 -0400
committerSean Bright <sean.bright@gmail.com>2017-03-20 08:55:05 -0400
commitfc71c18a9b572296e171eb6b1f87aee5c2256c8c (patch)
tree8c1123cca9cfe951f7562dcd80a4b8d24e0bb9f6 /main/manager.c
parentb05d2fda0c8b3473c3d6d7bd1cc0473e2728b744 (diff)
thread safety: Don't use getprotobyname()
POSIX does not require getprotobyname() to be thread safe and some implementations use static memory which causes issues when multiple threads are used. Further, our usage of it today is just to ultimately get IPPROTO_TCP for calls to setsockopt(). So instead we just use IPPROTO_TCP directly. Change-Id: I2e14e58674808f7ce99b2f5e900d0f90d0d8da48
Diffstat (limited to 'main/manager.c')
-rw-r--r--main/manager.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/manager.c b/main/manager.c
index eae1ca52a..c1d73dce7 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -6647,8 +6647,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. */
- if (setsockopt(ast_iostream_get_fd(ser->stream), IPPROTO_TCP, 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));
+ if (setsockopt(ast_iostream_get_fd(ser->stream), IPPROTO_TCP, TCP_NODELAY, (char *) &arg, sizeof(arg)) < 0) {
+ ast_log(LOG_WARNING, "Failed to set TCP_NODELAY on manager connection: %s\n", strerror(errno));
}
ast_iostream_nonblock(ser->stream);