22
22
23
23
#define FD_BUNDLE_CLIENT_REQUEST_TIMEOUT ((long)8e9) /* 8 seconds */
24
24
25
+ __attribute__((weak )) long
26
+ fd_bundle_tickcount ( void ) {
27
+ return fd_tickcount ();
28
+ }
29
+
25
30
void
26
31
fd_bundle_client_reset ( fd_bundle_tile_t * ctx ) {
27
32
if ( FD_UNLIKELY ( ctx -> tcp_sock >= 0 ) ) {
@@ -49,7 +54,7 @@ fd_bundle_client_reset( fd_bundle_tile_t * ctx ) {
49
54
}
50
55
# endif
51
56
52
- fd_bundle_tile_backoff ( ctx , fd_tickcount () );
57
+ fd_bundle_tile_backoff ( ctx , fd_bundle_tickcount () );
53
58
54
59
fd_bundle_auther_reset ( & ctx -> auther );
55
60
fd_grpc_client_reset ( ctx -> grpc_client );
@@ -154,7 +159,7 @@ fd_bundle_client_create_conn( fd_bundle_tile_t * ctx ) {
154
159
# endif /* FD_HAS_OPENSSL */
155
160
156
161
fd_grpc_client_reset ( ctx -> grpc_client );
157
- ctx -> last_ping_tx_ticks = fd_tickcount ();
162
+ ctx -> last_ping_tx_ticks = fd_bundle_tickcount ();
158
163
ctx -> last_ping_tx_nanos = fd_log_wallclock ();
159
164
}
160
165
@@ -245,7 +250,7 @@ fd_bundle_client_send_ping( fd_bundle_tile_t * ctx ) {
245
250
fd_h2_rbuf_t * rbuf_tx = fd_grpc_client_rbuf_tx ( ctx -> grpc_client );
246
251
247
252
if ( FD_LIKELY ( fd_h2_tx_ping ( conn , rbuf_tx ) ) ) {
248
- ctx -> last_ping_tx_ticks = fd_tickcount ();
253
+ ctx -> last_ping_tx_ticks = fd_bundle_tickcount ();
249
254
ctx -> last_ping_tx_nanos = fd_log_wallclock ();
250
255
ctx -> ping_randomize = fd_rng_ulong ( ctx -> rng );
251
256
}
@@ -338,7 +343,7 @@ fd_bundle_client_step1( fd_bundle_tile_t * ctx,
338
343
/* gRPC conn died? */
339
344
if ( FD_UNLIKELY ( !ctx -> grpc_client ) ) {
340
345
reconnect :
341
- if ( FD_UNLIKELY ( fd_bundle_tile_should_stall ( ctx , fd_tickcount () ) ) ) {
346
+ if ( FD_UNLIKELY ( fd_bundle_tile_should_stall ( ctx , fd_bundle_tickcount () ) ) ) {
342
347
return ;
343
348
}
344
349
fd_bundle_client_create_conn ( ctx );
@@ -347,7 +352,7 @@ fd_bundle_client_step1( fd_bundle_tile_t * ctx,
347
352
}
348
353
349
354
/* Did a HTTP/2 PING time out */
350
- long check_ts = fd_tickcount ();
355
+ long check_ts = fd_bundle_tickcount ();
351
356
if ( FD_UNLIKELY ( fd_bundle_client_ping_is_timeout ( ctx , check_ts ) ) ) {
352
357
FD_LOG_WARNING (( "Bundle gRPC timed out (HTTP/2 PING went unanswered for %.2f seconds)" ,
353
358
( (double )ctx -> ping_deadline_ticks / fd_tempo_tick_per_ns ( NULL ) )* 1e-9 ));
@@ -367,7 +372,7 @@ fd_bundle_client_step1( fd_bundle_tile_t * ctx,
367
372
368
373
/* Are we ready to issue a new request? */
369
374
if ( FD_UNLIKELY ( fd_grpc_client_request_is_blocked ( ctx -> grpc_client ) ) ) return ;
370
- long io_ts = fd_tickcount ();
375
+ long io_ts = fd_bundle_tickcount ();
371
376
if ( FD_UNLIKELY ( fd_bundle_tile_should_stall ( ctx , io_ts ) ) ) return ;
372
377
373
378
* charge_busy |= fd_bundle_client_step_reconnect ( ctx , io_ts );
@@ -471,7 +476,7 @@ fd_bundle_tile_publish_bundle_txn(
471
476
FD_LOG_CRIT (( "ctx->stem not set. This is a bug." ));
472
477
}
473
478
474
- ulong tspub = (ulong )fd_frag_meta_ts_comp ( fd_tickcount () );
479
+ ulong tspub = (ulong )fd_frag_meta_ts_comp ( fd_bundle_tickcount () );
475
480
fd_stem_publish ( ctx -> stem , ctx -> verify_out .idx , sig , ctx -> verify_out .chunk , sz , 0UL , 0UL , tspub );
476
481
ctx -> verify_out .chunk = fd_dcache_compact_next ( ctx -> verify_out .chunk , sz , ctx -> verify_out .chunk0 , ctx -> verify_out .wmark );
477
482
ctx -> metrics .txn_received_cnt ++ ;
@@ -506,7 +511,7 @@ fd_bundle_tile_publish_txn(
506
511
FD_LOG_CRIT (( "ctx->stem not set. This is a bug." ));
507
512
}
508
513
509
- ulong tspub = (ulong )fd_frag_meta_ts_comp ( fd_tickcount () );
514
+ ulong tspub = (ulong )fd_frag_meta_ts_comp ( fd_bundle_tickcount () );
510
515
fd_stem_publish ( ctx -> stem , ctx -> verify_out .idx , sig , ctx -> verify_out .chunk , sz , 0UL , 0UL , tspub );
511
516
ctx -> verify_out .chunk = fd_dcache_compact_next ( ctx -> verify_out .chunk , sz , ctx -> verify_out .chunk0 , ctx -> verify_out .wmark );
512
517
ctx -> metrics .txn_received_cnt ++ ;
@@ -716,7 +721,7 @@ fd_bundle_client_handle_builder_fee_info(
716
721
717
722
long validity_duration_ticks = (long )( fd_tempo_tick_per_ns ( NULL ) * (60e9 * 5. ) ); /* 5 minutes */
718
723
ctx -> builder_info_avail = 1 ;
719
- ctx -> builder_info_valid_until_ticks = fd_tickcount () + validity_duration_ticks ;
724
+ ctx -> builder_info_valid_until_ticks = fd_bundle_tickcount () + validity_duration_ticks ;
720
725
}
721
726
722
727
static void
@@ -758,13 +763,13 @@ fd_bundle_client_grpc_rx_msg(
758
763
case FD_BUNDLE_CLIENT_REQ_Auth_GenerateAuthChallenge :
759
764
if ( FD_UNLIKELY ( !fd_bundle_auther_handle_challenge_resp ( & ctx -> auther , protobuf , protobuf_sz ) ) ) {
760
765
ctx -> metrics .decode_fail_cnt ++ ;
761
- fd_bundle_tile_backoff ( ctx , fd_tickcount () );
766
+ fd_bundle_tile_backoff ( ctx , fd_bundle_tickcount () );
762
767
}
763
768
break ;
764
769
case FD_BUNDLE_CLIENT_REQ_Auth_GenerateAuthTokens :
765
770
if ( FD_UNLIKELY ( !fd_bundle_auther_handle_tokens_resp ( & ctx -> auther , protobuf , protobuf_sz ) ) ) {
766
771
ctx -> metrics .decode_fail_cnt ++ ;
767
- fd_bundle_tile_backoff ( ctx , fd_tickcount () );
772
+ fd_bundle_tile_backoff ( ctx , fd_bundle_tickcount () );
768
773
}
769
774
break ;
770
775
case FD_BUNDLE_CLIENT_REQ_Bundle_SubscribeBundles :
@@ -784,7 +789,7 @@ fd_bundle_client_grpc_rx_msg(
784
789
static void
785
790
fd_bundle_client_request_failed ( fd_bundle_tile_t * ctx ,
786
791
ulong request_ctx ) {
787
- fd_bundle_tile_backoff ( ctx , fd_tickcount () );
792
+ fd_bundle_tile_backoff ( ctx , fd_bundle_tickcount () );
788
793
switch ( request_ctx ) {
789
794
case FD_BUNDLE_CLIENT_REQ_Auth_GenerateAuthChallenge :
790
795
case FD_BUNDLE_CLIENT_REQ_Auth_GenerateAuthTokens :
@@ -816,15 +821,15 @@ fd_bundle_client_grpc_rx_end(
816
821
case FD_BUNDLE_CLIENT_REQ_Bundle_SubscribePackets :
817
822
ctx -> packet_subscription_live = 0 ;
818
823
ctx -> packet_subscription_wait = 0 ;
819
- fd_bundle_tile_backoff ( ctx , fd_tickcount () );
824
+ fd_bundle_tile_backoff ( ctx , fd_bundle_tickcount () );
820
825
ctx -> defer_reset = 1 ;
821
826
FD_LOG_INFO (( "SubscribePackets stream failed (gRPC status %u-%s). Reconnecting ..." ,
822
827
resp -> grpc_status , fd_grpc_status_cstr ( resp -> grpc_status ) ));
823
828
return ;
824
829
case FD_BUNDLE_CLIENT_REQ_Bundle_SubscribeBundles :
825
830
ctx -> bundle_subscription_live = 0 ;
826
831
ctx -> bundle_subscription_wait = 0 ;
827
- fd_bundle_tile_backoff ( ctx , fd_tickcount () );
832
+ fd_bundle_tile_backoff ( ctx , fd_bundle_tickcount () );
828
833
ctx -> defer_reset = 1 ;
829
834
FD_LOG_INFO (( "SubscribeBundles stream failed (gRPC status %u-%s). Reconnecting ..." ,
830
835
resp -> grpc_status , fd_grpc_status_cstr ( resp -> grpc_status ) ));
@@ -864,7 +869,7 @@ fd_bundle_client_grpc_rx_timeout(
864
869
static void
865
870
fd_bundle_client_grpc_ping_ack ( void * app_ctx ) {
866
871
fd_bundle_tile_t * ctx = app_ctx ;
867
- ctx -> last_ping_rx_ticks = fd_tickcount ();
872
+ ctx -> last_ping_rx_ticks = fd_bundle_tickcount ();
868
873
ctx -> metrics .ping_ack_cnt ++ ;
869
874
long rtt_sample = fd_log_wallclock () - ctx -> last_ping_tx_nanos ;
870
875
fd_rtt_sample ( ctx -> rtt , (float )rtt_sample , 0 );
@@ -921,7 +926,7 @@ fd_bundle_client_status( fd_bundle_tile_t const * ctx ) {
921
926
return CONNECTING ; /* not fully connected */
922
927
}
923
928
924
- if ( FD_UNLIKELY ( fd_bundle_client_ping_is_timeout ( ctx , fd_tickcount () ) ) ) {
929
+ if ( FD_UNLIKELY ( fd_bundle_client_ping_is_timeout ( ctx , fd_bundle_tickcount () ) ) ) {
925
930
return DISCONNECTED ; /* possible timeout */
926
931
}
927
932
0 commit comments