Skip to content
Snippets Groups Projects
Commit 3b233f11 authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

fix cpu-overload during file transfer acceptance


TLS session was busy in handleStateEstablished()
during a data-transfer in "wait_host_acceptance" state.
Use a simple thread sleep instead of waitForData() to solve the issue.

Change-Id: I38b7a036863da950202597d52debbfff3329b875
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent 82e02780
Branches
No related tags found
No related merge requests found
......@@ -1070,13 +1070,12 @@ TlsSession::TlsSessionImpl::handleStateEstablished(TlsSessionState state)
{
// Nothing to do in reliable mode, so just wait for state change
if (transport_.isReliable()) {
std::error_code ec;
do {
transport_.waitForData(100, ec);
while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
state = state_.load();
if (state != TlsSessionState::ESTABLISHED)
return state;
} while (!ec);
}
return TlsSessionState::SHUTDOWN;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment