Issue #92 Valgrind error fixes.

Eliminated debug checks.
This commit is contained in:
Bartek Wrona 2017-08-29 11:28:42 +02:00 committed by Eric Frias
parent b5c8cd0ad3
commit d8e545bb53

View file

@ -63,7 +63,6 @@ namespace graphene { namespace net {
fc::time_point _last_message_sent_time; fc::time_point _last_message_sent_time;
bool _send_message_in_progress; bool _send_message_in_progress;
std::atomic_bool readLoopInProgress;
#ifndef NDEBUG #ifndef NDEBUG
fc::thread* _thread; fc::thread* _thread;
#endif #endif
@ -99,8 +98,7 @@ namespace graphene { namespace net {
_delegate(delegate), _delegate(delegate),
_bytes_received(0), _bytes_received(0),
_bytes_sent(0), _bytes_sent(0),
_send_message_in_progress(false), _send_message_in_progress(false)
readLoopInProgress(false)
#ifndef NDEBUG #ifndef NDEBUG
,_thread(&fc::thread::current()) ,_thread(&fc::thread::current())
#endif #endif
@ -140,21 +138,6 @@ namespace graphene { namespace net {
_sock.bind(local_endpoint); _sock.bind(local_endpoint);
} }
class THelper final
{
std::atomic_bool* Flag;
public:
explicit THelper(std::atomic_bool* flag) : Flag(flag)
{
FC_ASSERT(*flag == false, "Only one thread at time can visit it");
*flag = true;
}
~THelper()
{
*Flag = false;
}
};
void message_oriented_connection_impl::read_loop() void message_oriented_connection_impl::read_loop()
{ {
VERIFY_CORRECT_THREAD(); VERIFY_CORRECT_THREAD();
@ -162,8 +145,6 @@ namespace graphene { namespace net {
const int LEFTOVER = BUFFER_SIZE - sizeof(message_header); const int LEFTOVER = BUFFER_SIZE - sizeof(message_header);
static_assert(BUFFER_SIZE >= sizeof(message_header), "insufficient buffer"); static_assert(BUFFER_SIZE >= sizeof(message_header), "insufficient buffer");
THelper helper(&this->readLoopInProgress);
_connected_time = fc::time_point::now(); _connected_time = fc::time_point::now();
fc::oexception exception_to_rethrow; fc::oexception exception_to_rethrow;