From 4100e459b23d72be8ba8b42e59f7366ab405866b Mon Sep 17 00:00:00 2001 From: abitmore Date: Thu, 14 Dec 2023 09:09:18 +0000 Subject: [PATCH 1/3] Try to fix syncing issue --- libraries/net/message_oriented_connection.cpp | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/libraries/net/message_oriented_connection.cpp b/libraries/net/message_oriented_connection.cpp index 3ddc54a34a..0bc2145abf 100644 --- a/libraries/net/message_oriented_connection.cpp +++ b/libraries/net/message_oriented_connection.cpp @@ -172,6 +172,7 @@ namespace graphene { namespace net { fc::oexception exception_to_rethrow; bool call_on_connection_closed = false; + bool io_error = false; try { @@ -179,7 +180,12 @@ namespace graphene { namespace net { char buffer[BUFFER_SIZE]; while( true ) { - _sock.read(buffer, BUFFER_SIZE); + try { + _sock.read(buffer, BUFFER_SIZE); + } catch ( const fc::canceled_exception& ) { + io_error = true; + throw; + } _bytes_received += BUFFER_SIZE; memcpy((char*)&m, buffer, sizeof(message_header)); FC_ASSERT( m.size.value() <= MAX_MESSAGE_SIZE, "", ("m.size",m.size.value())("MAX_MESSAGE_SIZE",MAX_MESSAGE_SIZE) ); @@ -189,7 +195,12 @@ namespace graphene { namespace net { std::copy(buffer + sizeof(message_header), buffer + sizeof(buffer), m.data.begin()); if (remaining_bytes_with_padding) { - _sock.read(&m.data[LEFTOVER], remaining_bytes_with_padding); + try { + _sock.read(&m.data[LEFTOVER], remaining_bytes_with_padding); + } catch ( const fc::canceled_exception& ) { + io_error = true; + throw; + } _bytes_received += remaining_bytes_with_padding; } m.data.resize(m.size.value()); // truncate off the padding bytes @@ -214,8 +225,20 @@ namespace graphene { namespace net { } catch ( const fc::canceled_exception& e ) { - wlog( "caught a canceled_exception in read_loop. this should mean we're in the process of deleting this object already, so there's no need to notify the delegate: ${e}", ("e", e.to_detail_string() ) ); - throw; + if( io_error ) + { + wlog( "disconnected on io error ${e}", ("e", e.to_detail_string() ) ); + call_on_connection_closed = true; + exception_to_rethrow = fc::unhandled_exception(FC_LOG_MESSAGE(warn, "disconnected on io error: ${e}", + ("e", e.to_detail_string()))); + } + else + { + wlog( "caught a canceled_exception in read_loop. this should mean we're in the process of deleting " + "this object already, so there's no need to notify the delegate: ${e}", + ("e", e.to_detail_string() ) ); + throw; + } } catch ( const fc::eof_exception& e ) { From 9ed758bb9c50e9fdb1267b3eb7c01d9a36500a15 Mon Sep 17 00:00:00 2001 From: abitmore Date: Wed, 7 Feb 2024 14:46:40 +0000 Subject: [PATCH 2/3] Update sonar.branch.target for release branch --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index d2b5cb4488..918a41f2f9 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -29,4 +29,4 @@ sonar.coverageReportPaths=coverage.xml # Decide which tree the current build belongs to in SonarCloud. # Managed by the `set_sonar_branch*` script(s) when building with CI. -sonar.branch.target=develop +sonar.branch.target=master From 8246be822aa1b8ef96a05d27898d6cd90681eae1 Mon Sep 17 00:00:00 2001 From: abitmore Date: Thu, 8 Feb 2024 22:07:07 +0000 Subject: [PATCH 3/3] Update sonar.branch.target for develop branch --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 918a41f2f9..d2b5cb4488 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -29,4 +29,4 @@ sonar.coverageReportPaths=coverage.xml # Decide which tree the current build belongs to in SonarCloud. # Managed by the `set_sonar_branch*` script(s) when building with CI. -sonar.branch.target=master +sonar.branch.target=develop