Changeset 182:ae4f8f53110b in finroc_plugins_tcp
- Timestamp:
- 29.04.2020 13:28:28 (3 years ago)
- Branch:
- 14.08
- Phase:
- public
- Rebase:
- 61366237393063646132353064633838363337346437343166316665363464373865353930346632
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
internal/tServer.cpp
r149 r182 75 75 //---------------------------------------------------------------------- 76 76 77 namespace 78 { 79 80 size_t connection_error_count = 0; 81 rrlib::time::tTimestamp last_unfiltered_connection_error = rrlib::time::cNO_TIME; 82 const int cMAX_DISPLAYED_CONNECTION_ERRORS = 5; 83 const rrlib::time::tDuration cMAX_DISPLAYED_CONNECTION_ERRORS_PERIOD = std::chrono::seconds(10); 84 85 } 86 77 87 /*! 78 88 * Handles accepted connections … … 96 106 else 97 107 { 98 FINROC_LOG_PRINT(ERROR, "Connection error ", error.category().name()); 108 auto now = rrlib::time::Now(); 109 110 if (now > last_unfiltered_connection_error + cMAX_DISPLAYED_CONNECTION_ERRORS_PERIOD) 111 { 112 if (connection_error_count > cMAX_DISPLAYED_CONNECTION_ERRORS) 113 { 114 FINROC_LOG_PRINT(ERROR, "Filtered ", connection_error_count - cMAX_DISPLAYED_CONNECTION_ERRORS , " additional errors"); 115 } 116 connection_error_count = 0; 117 } 118 119 connection_error_count++; 120 if (connection_error_count <= cMAX_DISPLAYED_CONNECTION_ERRORS) 121 { 122 FINROC_LOG_PRINT(ERROR, "Connection error ", error); 123 if (connection_error_count == cMAX_DISPLAYED_CONNECTION_ERRORS) 124 { 125 FINROC_LOG_PRINT(ERROR, "Filtering additional errors..."); 126 } 127 last_unfiltered_connection_error = now; 128 } 99 129 } 100 130
Note: See TracChangeset
for help on using the changeset viewer.