New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add LOCK() for proxy related data-structures #1859
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -145,18 +145,18 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const | ||
case ProxyUse: | case ProxyUse: | ||
return settings.value("fUseProxy", false); | return settings.value("fUseProxy", false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @laanwj I was asking myself, if this should be changed into, as data() returns active state for IP, port and SOCKS version, too. case ProxyUse: { proxyType proxy; return QVariant(GetProxy(NET_IPV4, proxy)); } There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be better because that better represents the current configuration, but leave that for a later pull. Aim to keep functionality precisely the same in these commits. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood :), thanks for your valuable input master! |
|||
case ProxyIP: { | case ProxyIP: { | ||
CService addrProxy; | proxyType proxy; | ||
if (GetProxy(NET_IPV4, addrProxy)) | if (GetProxy(NET_IPV4, proxy)) | ||
return QVariant(QString::fromStdString(addrProxy.ToStringIP())); | return QVariant(QString::fromStdString(proxy.first.ToStringIP())); | ||
else | else | ||
return QVariant(QString::fromStdString("127.0.0.1")); | return QVariant(QString::fromStdString("127.0.0.1")); | ||
} | } | ||
case ProxyPort: { | case ProxyPort: { | ||
CService addrProxy; | proxyType proxy; | ||
if (GetProxy(NET_IPV4, addrProxy)) | if (GetProxy(NET_IPV4, proxy)) | ||
return QVariant(addrProxy.GetPort()); | return QVariant(proxy.first.GetPort()); | ||
else | else | ||
return 9050; | return QVariant(9050); | ||
} | } | ||
case ProxySocksVersion: | case ProxySocksVersion: | ||
return settings.value("nSocksVersion", 5); | return settings.value("nSocksVersion", 5); | ||
|
@@ -176,6 +176,7 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const | ||
} | } | ||
return QVariant(); | return QVariant(); | ||
} | } | ||
|
|||
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role) | bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role) | ||
{ | { | ||
bool successful = true; /* set to false on parse error */ | bool successful = true; /* set to false on parse error */ | ||
|
@@ -204,29 +205,37 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in | ||
settings.setValue("fUseProxy", value.toBool()); | settings.setValue("fUseProxy", value.toBool()); | ||
ApplyProxySettings(); | ApplyProxySettings(); | ||
break; | break; | ||
case ProxyIP: | case ProxyIP: { | ||
{ | proxyType proxy; | ||
CService addrProxy("127.0.0.1", 9050); | proxy.first = CService("127.0.0.1", 9050); | ||
GetProxy(NET_IPV4, addrProxy); | GetProxy(NET_IPV4, proxy); | ||
CNetAddr addr(value.toString().toStdString()); |
|
||
addrProxy.SetIP(addr); | CNetAddr addr(value.toString().toStdString()); | ||
settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str()); | proxy.first.SetIP(addr); | ||
successful = ApplyProxySettings(); | settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str()); | ||
} | successful = ApplyProxySettings(); | ||
break; | } | ||
case ProxyPort: | break; | ||
{ | case ProxyPort: { | ||
CService addrProxy("127.0.0.1", 9050); | proxyType proxy; | ||
GetProxy(NET_IPV4, addrProxy); | proxy.first = CService("127.0.0.1", 9050); | ||
addrProxy.SetPort(value.toInt()); | GetProxy(NET_IPV4, proxy); | ||
settings.setValue("addrProxy", addrProxy.ToStringIPPort().c_str()); |
|
||
successful = ApplyProxySettings(); | proxy.first.SetPort(value.toInt()); | ||
} | settings.setValue("addrProxy", proxy.first.ToStringIPPort().c_str()); | ||
break; | successful = ApplyProxySettings(); | ||
case ProxySocksVersion: | } | ||
settings.setValue("nSocksVersion", value.toInt()); | break; | ||
ApplyProxySettings(); | case ProxySocksVersion: { | ||
break; | proxyType proxy; | ||
proxy.second = 5; | |||
GetProxy(NET_IPV4, proxy); | |||
|
|||
proxy.second = value.toInt(); | |||
settings.setValue("nSocksVersion", proxy.second); | |||
successful = ApplyProxySettings(); | |||
} | |||
break; | |||
case Fee: | case Fee: | ||
nTransactionFee = value.toLongLong(); | nTransactionFee = value.toLongLong(); | ||
settings.setValue("nTransactionFee", nTransactionFee); | settings.setValue("nTransactionFee", nTransactionFee); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: never mind, it does exactly what it says, I misunderstood the function.