Skip to content

Commit 446f2e6

Browse files
committed
Merge commit '735f68454793309b9367864f219eb6368c809281' into develop
2 parents cc3e3f0 + 735f684 commit 446f2e6

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

airdcpp-core/airdcpp/AdcHub.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ void AdcHub::handle(AdcCommand::INF, AdcCommand& c) noexcept {
256256
u->getUser()->setFlag(User::ASCH);
257257
}
258258

259-
if(u->getUser() == getMyIdentity().getUser()) {
259+
if (u->getUser() == getMyIdentity().getUser()) {
260260
State oldState = getConnectState();
261261
if (oldState != STATE_NORMAL) {
262262
setConnectState(STATE_NORMAL);
@@ -267,8 +267,18 @@ void AdcHub::handle(AdcCommand::INF, AdcCommand& c) noexcept {
267267
setMyIdentity(u->getIdentity());
268268
updateCounts(false);
269269

270-
if (oldState != STATE_NORMAL && u->getIdentity().getAdcConnectionSpeed(false) == 0)
271-
statusMessage("WARNING: This hub is not displaying the connection speed fields, which prevents the client from choosing the best sources for downloads. Please advise the hub owner to fix this.", LogMessage::SEV_WARNING);
270+
if (oldState != STATE_NORMAL) {
271+
if (u->getIdentity().getAdcConnectionSpeed(false) == 0) {
272+
statusMessage("WARNING: This hub is not displaying the connection speed fields, which prevents the client from choosing the best sources for downloads. Please advise the hub owner to fix this.", LogMessage::SEV_WARNING);
273+
}
274+
275+
if (isSecure()) {
276+
auto encryption = getEncryptionInfo();
277+
if (encryption.find("TLSv1.2") == string::npos) {
278+
statusMessage("This hub uses an outdated cryptographic protocol that has known security issues", LogMessage::SEV_WARNING);
279+
}
280+
}
281+
}
272282

273283
//we have to update the modes in case our connectivity changed
274284

airdcpp-core/airdcpp/QueueManager.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ void QueueManager::on(TimerManagerListener::Minute, uint64_t aTick) noexcept {
488488
}
489489
}
490490

491+
void QueueManager::getBundleContent(const BundlePtr& aBundle, size_t& files_, size_t& directories_) const noexcept {
492+
RLock l(cs);
493+
files_ = aBundle->getQueueItems().size() + aBundle->getFinishedFiles().size();
494+
directories_ = aBundle->isFileBundle() ? 0 : aBundle->getDirectories().size() - 1;
495+
}
496+
491497
bool QueueManager::hasDownloadedBytes(const string& aTarget) throw(QueueException) {
492498
RLock l(cs);
493499
auto q = fileQueue.findFile(aTarget);

airdcpp-core/airdcpp/QueueManager.h

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class QueueManager : public Singleton<QueueManager>, public Speaker<QueueManager
6868
// Check if there are downloaded bytes (running downloads or finished segments) for the specified file
6969
bool hasDownloadedBytes(const string& aTarget) throw(QueueException);
7070

71+
// Get the subdirectories and total file count of a bundle
72+
void getBundleContent(const BundlePtr& aBundle, size_t& files_, size_t& directories_) const noexcept;
73+
7174
// Get the total queued bytes
7275
uint64_t getTotalQueueSize() const noexcept { return fileQueue.getTotalQueueSize(); }
7376

airdcpp-core/airdcpp/SSLSocket.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,9 @@ std::string SSLSocket::getEncryptionInfo() const noexcept {
241241
if (!ssl)
242242
return Util::emptyString;
243243

244-
const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl);
245-
if (!cipher)
246-
return Util::emptyString;
247-
248-
char* buf = SSL_CIPHER_description(cipher, NULL, 0);
249-
StringTokenizer<std::string> st(buf, ' ');
250-
std::string ret = st.getTokens()[1] + " / " + st.getTokens()[0];
251-
delete[] buf;
252-
return ret;
244+
string cipher = SSL_get_cipher_name(ssl);
245+
string protocol = SSL_get_version(ssl);
246+
return protocol + " / " + cipher;
253247
}
254248

255249
ByteVector SSLSocket::getKeyprint() const noexcept {

0 commit comments

Comments
 (0)