File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ lazy_static = "1.4.0"
5252libssh2-sys = { version = " 0.3.0" , optional = true }
5353lru = " 0.12"
5454mutants = " 0.0.3"
55+ rand = " 0.8"
5556rayon = " 1.3.0"
5657readahead-iterator = " 0.1.1"
5758regex = " 1.3.9"
@@ -109,7 +110,6 @@ predicates = "3"
109110pretty_assertions = " 1.0"
110111proptest = " 1.5"
111112proptest-derive = " 0.5"
112- rand = " 0.8"
113113rstest = { version = " 0.19" , default-features = false }
114114tracing-test = { version = " 0.2" , features = [" no-env-filter" ] }
115115
Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ impl Lease {
9797 client_version : Some ( crate :: VERSION . to_string ( ) ) ,
9898 acquired : lease_taken,
9999 expiry : lease_expiry,
100+ nonce : rand:: random ( ) ,
100101 } ;
101102 let url = transport. relative_file_url ( LEASE_FILENAME ) ;
102103 let mut s: String = serde_json:: to_string ( & content) . expect ( "serialize lease" ) ;
@@ -214,6 +215,8 @@ pub struct LeaseContent {
214215 pub pid : Option < u32 > ,
215216 /// Conserve version string.
216217 pub client_version : Option < String > ,
218+ /// Random nonce to distinguish different leases from the same client.
219+ pub nonce : u32 ,
217220
218221 /// Time when the lease was taken.
219222 #[ serde( with = "time::serde::iso8601" ) ]
@@ -323,7 +326,8 @@ mod test {
323326 "pid": 1234,
324327 "client_version": "0.1.2",
325328 "acquired": "2021-01-01T12:34:56Z",
326- "expiry": "2021-01-01T12:35:56Z"
329+ "expiry": "2021-01-01T12:35:56Z",
330+ "nonce": 12345
327331 }"# ,
328332 )
329333 . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments