Browse Source

fixed build error for gcc 4.7

pull/806/head
orignal 8 years ago
parent
commit
55f891e2aa
  1. 15
      NTCPSession.cpp

15
NTCPSession.cpp

@ -167,7 +167,13 @@ namespace transport
return; 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 // TODO: check for number of pending keys
auto s = shared_from_this (); auto s = shared_from_this ();
auto keyCreated = std::async (std::launch::async, [s] () auto keyCreated = std::async (std::launch::async, [s] ()
@ -181,6 +187,7 @@ namespace transport
keyCreated.get (); keyCreated.get ();
s->SendPhase2 (); s->SendPhase2 ();
}); });
#endif
} }
} }
@ -239,6 +246,11 @@ namespace transport
} }
else 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 (); auto s = shared_from_this ();
// create AES key in separate thread // create AES key in separate thread
auto keyCreated = std::async (std::launch::async, [s] () auto keyCreated = std::async (std::launch::async, [s] ()
@ -251,6 +263,7 @@ namespace transport
keyCreated.get (); // we might wait if no more pending operations keyCreated.get (); // we might wait if no more pending operations
s->HandlePhase2 (); s->HandlePhase2 ();
}); });
#endif
} }
} }

Loading…
Cancel
Save