From 62142859500e720005866b3756b60f6f043fd7ff Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Mon, 27 Feb 2012 14:57:23 +0000 Subject: [PATCH] Make ast_netsock_set_qos() delegate to ast_set_qos(). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356916 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/netsock.h | 2 +- main/netsock.c | 22 ++++------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/include/asterisk/netsock.h b/include/asterisk/netsock.h index 264cbdd627..01c877b91d 100644 --- a/include/asterisk/netsock.h +++ b/include/asterisk/netsock.h @@ -54,7 +54,7 @@ struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list, * \deprecated Use ast_seq_qos in netsock2.h which properly handles IPv4 and IPv6 * sockets, instead. */ -int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc); +int ast_netsock_set_qos(int sockfd, int tos, int cos, const char *desc); int ast_netsock_sockfd(const struct ast_netsock *ns); diff --git a/main/netsock.c b/main/netsock.c index f75db27adb..d178fbed49 100644 --- a/main/netsock.c +++ b/main/netsock.c @@ -42,6 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #endif #include "asterisk/netsock.h" +#include "asterisk/netsock2.h" #include "asterisk/utils.h" #include "asterisk/astobj.h" @@ -127,7 +128,7 @@ struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct i return NULL; } - ast_netsock_set_qos(netsocket, tos, cos, "IAX2"); + ast_set_qos(netsocket, tos, cos, "IAX2"); ast_enable_packet_fragmentation(netsocket); @@ -153,26 +154,11 @@ struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct i return ns; } -int ast_netsock_set_qos(int netsocket, int tos, int cos, const char *desc) +int ast_netsock_set_qos(int sockfd, int tos, int cos, const char *desc) { - int res; - - if ((res = setsockopt(netsocket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)))) - ast_log(LOG_WARNING, "Unable to set %s TOS to %d, may be you have no root privileges\n", desc, tos); - else if (tos) - ast_verb(2, "Using %s TOS bits %d\n", desc, tos); - -#if defined(linux) - if (setsockopt(netsocket, SOL_SOCKET, SO_PRIORITY, &cos, sizeof(cos))) - ast_log(LOG_WARNING, "Unable to set %s CoS to %d\n", desc, cos); - else if (cos) - ast_verb(2, "Using %s CoS mark %d\n", desc, cos); -#endif - - return res; + return ast_set_qos(sockfd, tos, cos, desc); } - struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc, const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data) { struct sockaddr_in sin;