summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2007-12-16 10:51:53 +0000
committerOlle Johansson <oej@edvina.net>2007-12-16 10:51:53 +0000
commit17afebc1a66f6cb114abfbd0a0490f7e45b3bdc6 (patch)
tree1737bbf754fc80795d7da8a7e44ef757640a050f /main
parent4d0ceb96ba5d97407f0ca819b0053055c4cc9d5d (diff)
HUGE improvements to QoS/CoS handling by IgorG
- Refer to the proper documentation - Implement separate signalling/media QoS/CoS in many channels using RTP - Improve warnings and verbose messages - Deprecate some old settings Minor modifications by me, a big effort from IgorG. Thanks! Reported by: IgorG Patches: qoscleanup-89394-4-trunk.patch uploaded by IgorG (license 20) Tested by: IgorG (closes issue #11145) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/netsock.c16
-rw-r--r--main/rtp.c4
-rw-r--r--main/udptl.c2
3 files changed, 11 insertions, 11 deletions
diff --git a/main/netsock.c b/main/netsock.c
index d10c0c344..27def180c 100644
--- a/main/netsock.c
+++ b/main/netsock.c
@@ -117,7 +117,7 @@ struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct i
return NULL;
}
- ast_netsock_set_qos(netsocket, tos, cos);
+ ast_netsock_set_qos(netsocket, tos, cos, "IAX2");
ast_enable_packet_fragmentation(netsocket);
@@ -143,20 +143,20 @@ 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)
+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 TOS to %d\n", tos);
- else
- ast_verb(2, "Using TOS bits %d\n", 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 CoS to %d\n", cos);
- else
- ast_verb(2, "Using CoS mark %d\n", 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;
diff --git a/main/rtp.c b/main/rtp.c
index fcc80df0e..35dd95904 100644
--- a/main/rtp.c
+++ b/main/rtp.c
@@ -2292,9 +2292,9 @@ struct ast_rtp *ast_rtp_new(struct sched_context *sched, struct io_context *io,
return ast_rtp_new_with_bindaddr(sched, io, rtcpenable, callbackmode, ia);
}
-int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos)
+int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos, char *desc)
{
- return ast_netsock_set_qos(rtp->s, tos, cos);
+ return ast_netsock_set_qos(rtp->s, tos, cos, desc);
}
void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
diff --git a/main/udptl.c b/main/udptl.c
index f14502c71..12de3fd53 100644
--- a/main/udptl.c
+++ b/main/udptl.c
@@ -849,7 +849,7 @@ struct ast_udptl *ast_udptl_new(struct sched_context *sched, struct io_context *
int ast_udptl_setqos(struct ast_udptl *udptl, int tos, int cos)
{
- return ast_netsock_set_qos(udptl->fd, tos, cos);
+ return ast_netsock_set_qos(udptl->fd, tos, cos, "UDPTL");
}
void ast_udptl_set_peer(struct ast_udptl *udptl, struct sockaddr_in *them)