File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2214,6 +2214,25 @@ void setup_signals(void)
22142214}
22152215#endif /* !WIN32*/
22162216
2217+ /* Return 1 if driver can now report custom reconnection start/progress details */
2218+ int may_log_reconnect_trying (int throttle_hit ) {
2219+ if (reconnect_count > 0 ) {
2220+ /* Accounting reconnections already, no care about throttling - be quiet */
2221+ if (!throttle_hit || reconnect_report_freq < 1 )
2222+ return 0 ;
2223+
2224+ /* At that point in throttling where we may talk */
2225+ if ((reconnect_count % reconnect_report_freq ) == 0 )
2226+ return 1 ;
2227+
2228+ /* Throttling - be quiet */
2229+ return 0 ;
2230+ }
2231+
2232+ /* Not counting yet, would be a first report */
2233+ return 1 ;
2234+ }
2235+
22172236/* Called by a driver to either enter/continue a reconnection loop
22182237 * (trying=1), almost done (trying=2), or to end it (trying=0).
22192238 * Return how many attempts remain before driver exits (-1 if it won't).
Original file line number Diff line number Diff line change @@ -134,6 +134,17 @@ typedef enum reconnect_state {
134134 */
135135int reconnect_trying (reconnect_state_t trying );
136136
137+ /** Return 1 if driver can now report custom reconnection start/progress
138+ * details, with common information to be logged by reconnect_trying(),
139+ * otherwise 0. If `throttle_hit!=0`, check if `reconnect_report_freq>0`
140+ * and `reconnect_count%reconnect_report_freq == 0` to allow a progress
141+ * report to be logged.
142+ *
143+ * This method should be called before reconnect_trying(RECONNECT_TRYING)
144+ * bumps the counters involved.
145+ */
146+ int may_log_reconnect_trying (int throttle_hit );
147+
137148/* Several helpers for driver configuration reloading follow:
138149 * * testval_reloadable() checks if we are currently reloading (or initially
139150 * loading) the configuration, and if strings oldval==newval or not,
You can’t perform that action at this time.
0 commit comments