@@ -14,6 +14,8 @@ pub struct Options {
14
14
wait_for_connection : Arc < AtomicBool > ,
15
15
/// Wait for the msg to be sent (default: true)
16
16
wait_for_send : Arc < AtomicBool > ,
17
+ /// Wait for the subscription msg to be sent (default: false)
18
+ wait_for_subscription : Arc < AtomicBool > ,
17
19
/// POW difficulty for all events (default: 0)
18
20
difficulty : Arc < AtomicU8 > ,
19
21
/// REQ filters chunk size (default: 10)
@@ -30,6 +32,7 @@ impl Default for Options {
30
32
Self {
31
33
wait_for_connection : Arc :: new ( AtomicBool :: new ( false ) ) ,
32
34
wait_for_send : Arc :: new ( AtomicBool :: new ( true ) ) ,
35
+ wait_for_subscription : Arc :: new ( AtomicBool :: new ( false ) ) ,
33
36
difficulty : Arc :: new ( AtomicU8 :: new ( 0 ) ) ,
34
37
req_filters_chunk_size : Arc :: new ( AtomicU8 :: new ( 10 ) ) ,
35
38
timeout : None ,
@@ -69,6 +72,18 @@ impl Options {
69
72
self . wait_for_send . load ( Ordering :: SeqCst )
70
73
}
71
74
75
+ /// If set to `true`, `Client` wait that a subscription msg is sent before continue (`subscribe` and `unsubscribe` methods)
76
+ pub fn wait_for_subscription ( self , wait : bool ) -> Self {
77
+ Self {
78
+ wait_for_subscription : Arc :: new ( AtomicBool :: new ( wait) ) ,
79
+ ..self
80
+ }
81
+ }
82
+
83
+ pub ( crate ) fn get_wait_for_subscription ( & self ) -> bool {
84
+ self . wait_for_subscription . load ( Ordering :: SeqCst )
85
+ }
86
+
72
87
/// Set default POW diffficulty for `Event`
73
88
pub fn difficulty ( self , difficulty : u8 ) -> Self {
74
89
Self {
0 commit comments