mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
Clientside QoS option
This commit is contained in:
parent
26d77a21f6
commit
2ea8eded44
@ -59,6 +59,7 @@ QIcon NetworkConfig::icon() const {
|
||||
void NetworkConfig::load(const Settings &r) {
|
||||
|
||||
loadCheckBox(qcbTcpMode, s.bTCPCompat);
|
||||
loadCheckBox(qcbQoS, s.bQoS);
|
||||
loadCheckBox(qcbAutoReconnect, s.bReconnect);
|
||||
loadCheckBox(qcbSuppressIdentity, s.bSuppressIdentity);
|
||||
loadComboBox(qcbType, s.ptProxyType);
|
||||
@ -84,6 +85,7 @@ void NetworkConfig::load(const Settings &r) {
|
||||
|
||||
void NetworkConfig::save() const {
|
||||
s.bTCPCompat = qcbTcpMode->isChecked();
|
||||
s.bQoS = qcbQoS->isChecked();
|
||||
s.bReconnect = qcbAutoReconnect->isChecked();
|
||||
s.bSuppressIdentity = qcbSuppressIdentity->isChecked();
|
||||
|
||||
@ -152,6 +154,7 @@ void NetworkConfig::accept() const {
|
||||
|
||||
bool NetworkConfig::expert(bool b) {
|
||||
qcbTcpMode->setVisible(b);
|
||||
qcbQoS->setVisible(b);
|
||||
qgbProxy->setVisible(b);
|
||||
qcbUsage->setVisible(b);
|
||||
|
||||
|
||||
@ -39,6 +39,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="qcbQoS">
|
||||
<property name="toolTip">
|
||||
<string>Enable QoS to prioritize packets</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This will enable QoS, which will attempt to prioritize voice packets over other traffic.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use Quality of Service</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="qcbAutoReconnect">
|
||||
<property name="toolTip">
|
||||
|
||||
@ -403,7 +403,8 @@ void ServerHandler::serverConnectionClosed(const QString &reason) {
|
||||
}
|
||||
|
||||
void ServerHandler::serverConnectionConnected() {
|
||||
cConnection->setToS();
|
||||
if (g.s.bQoS)
|
||||
cConnection->setToS();
|
||||
|
||||
qscCert = cConnection->peerCertificateChain();
|
||||
qscCipher = cConnection->sessionCipher();
|
||||
@ -457,24 +458,26 @@ void ServerHandler::serverConnectionConnected() {
|
||||
|
||||
connect(qusUdp, SIGNAL(readyRead()), this, SLOT(udpReady()));
|
||||
|
||||
if (g.s.bQoS) {
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
int val = 0xe0;
|
||||
if (setsockopt(qusUdp->socketDescriptor(), IPPROTO_IP, IP_TOS, &val, sizeof(val)))
|
||||
qWarning("ServerHandler: Failed to set TOS for UDP Socket");
|
||||
int val = 0xe0;
|
||||
if (setsockopt(qusUdp->socketDescriptor(), IPPROTO_IP, IP_TOS, &val, sizeof(val)))
|
||||
qWarning("ServerHandler: Failed to set TOS for UDP Socket");
|
||||
#elif defined(Q_OS_WIN)
|
||||
if (hQoS != NULL) {
|
||||
struct sockaddr_in addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(usPort);
|
||||
addr.sin_addr.s_addr = htonl(qhaRemote.toIPv4Address());
|
||||
if (hQoS != NULL) {
|
||||
struct sockaddr_in addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(usPort);
|
||||
addr.sin_addr.s_addr = htonl(qhaRemote.toIPv4Address());
|
||||
|
||||
dwFlowUDP = 0;
|
||||
if (! QOSAddSocketToFlow(hQoS, qusUdp->socketDescriptor(), reinterpret_cast<sockaddr *>(&addr), QOSTrafficTypeVoice, QOS_NON_ADAPTIVE_FLOW, &dwFlowUDP))
|
||||
qWarning("ServerHandler: Failed to add UDP to QOS");
|
||||
}
|
||||
dwFlowUDP = 0;
|
||||
if (! QOSAddSocketToFlow(hQoS, qusUdp->socketDescriptor(), reinterpret_cast<sockaddr *>(&addr), QOSTrafficTypeVoice, QOS_NON_ADAPTIVE_FLOW, &dwFlowUDP))
|
||||
qWarning("ServerHandler: Failed to add UDP to QOS");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
emit connected();
|
||||
|
||||
@ -218,6 +218,7 @@ Settings::Settings() {
|
||||
|
||||
// Network settings
|
||||
bTCPCompat = false;
|
||||
bQoS = true;
|
||||
bReconnect = true;
|
||||
ptProxyType = NoProxy;
|
||||
usProxyPort = 0;
|
||||
@ -367,6 +368,7 @@ void Settings::load() {
|
||||
|
||||
// Network settings
|
||||
SAVELOAD(bTCPCompat, "net/tcponly");
|
||||
SAVELOAD(bQoS, "net/qos");
|
||||
SAVELOAD(bReconnect, "net/reconnect");
|
||||
SAVELOAD(bSuppressIdentity, "net/suppress");
|
||||
LOADENUM(ptProxyType, "net/proxytype");
|
||||
@ -541,6 +543,7 @@ void Settings::save() {
|
||||
|
||||
// Network settings
|
||||
SAVELOAD(bTCPCompat, "net/tcponly");
|
||||
SAVELOAD(bQoS, "net/qos");
|
||||
SAVELOAD(bReconnect, "net/reconnect");
|
||||
SAVELOAD(ptProxyType, "net/proxytype");
|
||||
SAVELOAD(qsProxyHost, "net/proxyhost");
|
||||
|
||||
@ -182,7 +182,9 @@ struct Settings {
|
||||
|
||||
// Network settings
|
||||
enum ProxyType { NoProxy, HttpProxy, Socks5Proxy };
|
||||
bool bTCPCompat, bReconnect;
|
||||
bool bTCPCompat;
|
||||
bool bReconnect;
|
||||
bool bQoS;
|
||||
ProxyType ptProxyType;
|
||||
QString qsProxyHost, qsProxyUsername, qsProxyPassword;
|
||||
unsigned short usProxyPort;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user