diff --git a/NTCPSession.cpp b/NTCPSession.cpp index 48b4aecb..8dbe4fe7 100644 --- a/NTCPSession.cpp +++ b/NTCPSession.cpp @@ -167,7 +167,13 @@ namespace transport return; } } - +#if (__GNUC__ == 4) && (__GNUC_MINOR__ <= 7) +// due the bug in gcc 4.7. std::shared_future.get() is not const + if (!m_DHKeysPair) + m_DHKeysPair = transports.GetNextDHKeysPair (); + CreateAESKey (m_Establisher->phase1.pubKey); + SendPhase2 (); +#else // TODO: check for number of pending keys auto s = shared_from_this (); auto keyCreated = std::async (std::launch::async, [s] () @@ -180,7 +186,8 @@ namespace transport { keyCreated.get (); s->SendPhase2 (); - }); + }); +#endif } } @@ -239,6 +246,11 @@ namespace transport } else { +#if (__GNUC__ == 4) && (__GNUC_MINOR__ <= 7) +// due the bug in gcc 4.7. std::shared_future.get() is not const + CreateAESKey (m_Establisher->phase2.pubKey); + HandlePhase2 (); +#else auto s = shared_from_this (); // create AES key in separate thread auto keyCreated = std::async (std::launch::async, [s] () @@ -251,6 +263,7 @@ namespace transport keyCreated.get (); // we might wait if no more pending operations s->HandlePhase2 (); }); +#endif } }