[asterisk-commits] seanbright: trunk r356916 - in /trunk: include/asterisk/netsock.h main/netsock.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 27 08:57:27 CST 2012


Author: seanbright
Date: Mon Feb 27 08:57:23 2012
New Revision: 356916

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=356916
Log:
Make ast_netsock_set_qos() delegate to ast_set_qos().

Modified:
    trunk/include/asterisk/netsock.h
    trunk/main/netsock.c

Modified: trunk/include/asterisk/netsock.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/netsock.h?view=diff&rev=356916&r1=356915&r2=356916
==============================================================================
--- trunk/include/asterisk/netsock.h (original)
+++ trunk/include/asterisk/netsock.h Mon Feb 27 08:57:23 2012
@@ -54,7 +54,7 @@
  * \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);
 

Modified: trunk/main/netsock.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/netsock.c?view=diff&rev=356916&r1=356915&r2=356916
==============================================================================
--- trunk/main/netsock.c (original)
+++ trunk/main/netsock.c Mon Feb 27 08:57:23 2012
@@ -42,6 +42,7 @@
 #endif
 
 #include "asterisk/netsock.h"
+#include "asterisk/netsock2.h"
 #include "asterisk/utils.h"
 #include "asterisk/astobj.h"
 
@@ -127,7 +128,7 @@
 		return NULL;
 	}
 
-	ast_netsock_set_qos(netsocket, tos, cos, "IAX2");
+	ast_set_qos(netsocket, tos, cos, "IAX2");
 
 	ast_enable_packet_fragmentation(netsocket);
 
@@ -153,25 +154,10 @@
 	return ns;
 }
 
-int ast_netsock_set_qos(int netsocket, 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;
-}
-
+int ast_netsock_set_qos(int sockfd, int tos, int cos, const char *desc)
+{
+	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)
 {




More information about the asterisk-commits mailing list