Skip to content

Commit

Permalink
Merge commit '735f68454793309b9367864f219eb6368c809281' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
maksis committed Feb 2, 2016
2 parents cc3e3f0 + 735f684 commit 446f2e6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
16 changes: 13 additions & 3 deletions airdcpp-core/airdcpp/AdcHub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void AdcHub::handle(AdcCommand::INF, AdcCommand& c) noexcept {
u->getUser()->setFlag(User::ASCH);
}

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

if (oldState != STATE_NORMAL && u->getIdentity().getAdcConnectionSpeed(false) == 0)
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);
if (oldState != STATE_NORMAL) {
if (u->getIdentity().getAdcConnectionSpeed(false) == 0) {
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);
}

if (isSecure()) {
auto encryption = getEncryptionInfo();
if (encryption.find("TLSv1.2") == string::npos) {
statusMessage("This hub uses an outdated cryptographic protocol that has known security issues", LogMessage::SEV_WARNING);
}
}
}

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

Expand Down
6 changes: 6 additions & 0 deletions airdcpp-core/airdcpp/QueueManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ void QueueManager::on(TimerManagerListener::Minute, uint64_t aTick) noexcept {
}
}

void QueueManager::getBundleContent(const BundlePtr& aBundle, size_t& files_, size_t& directories_) const noexcept {
RLock l(cs);
files_ = aBundle->getQueueItems().size() + aBundle->getFinishedFiles().size();
directories_ = aBundle->isFileBundle() ? 0 : aBundle->getDirectories().size() - 1;
}

bool QueueManager::hasDownloadedBytes(const string& aTarget) throw(QueueException) {
RLock l(cs);
auto q = fileQueue.findFile(aTarget);
Expand Down
3 changes: 3 additions & 0 deletions airdcpp-core/airdcpp/QueueManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class QueueManager : public Singleton<QueueManager>, public Speaker<QueueManager
// Check if there are downloaded bytes (running downloads or finished segments) for the specified file
bool hasDownloadedBytes(const string& aTarget) throw(QueueException);

// Get the subdirectories and total file count of a bundle
void getBundleContent(const BundlePtr& aBundle, size_t& files_, size_t& directories_) const noexcept;

// Get the total queued bytes
uint64_t getTotalQueueSize() const noexcept { return fileQueue.getTotalQueueSize(); }

Expand Down
12 changes: 3 additions & 9 deletions airdcpp-core/airdcpp/SSLSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,9 @@ std::string SSLSocket::getEncryptionInfo() const noexcept {
if (!ssl)
return Util::emptyString;

const SSL_CIPHER* cipher = SSL_get_current_cipher(ssl);
if (!cipher)
return Util::emptyString;

char* buf = SSL_CIPHER_description(cipher, NULL, 0);
StringTokenizer<std::string> st(buf, ' ');
std::string ret = st.getTokens()[1] + " / " + st.getTokens()[0];
delete[] buf;
return ret;
string cipher = SSL_get_cipher_name(ssl);
string protocol = SSL_get_version(ssl);
return protocol + " / " + cipher;
}

ByteVector SSLSocket::getKeyprint() const noexcept {
Expand Down

0 comments on commit 446f2e6

Please sign in to comment.