mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-21 12:30:41 +00:00
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
This commit is contained in:
@@ -1917,9 +1917,8 @@ static void *httpd_helper_thread(void *data)
|
||||
* 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) {
|
||||
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 HTTP connection: %s\n", strerror(errno));
|
||||
ast_log(LOG_WARNING, "Some HTTP requests may be slow to respond.\n");
|
||||
}
|
||||
ast_iostream_nonblock(ser->stream);
|
||||
|
||||
|
Reference in New Issue
Block a user