@@ -68,8 +68,14 @@ impl Client {
68
68
69
69
match server. protocol {
70
70
Protocol :: Tcp => {
71
- stream_client:: connect_tcp ( handshake, server. local_addr , & self . env , subscriber)
72
- . await
71
+ stream_client:: connect_tcp (
72
+ handshake,
73
+ server. local_addr ,
74
+ & self . env ,
75
+ subscriber,
76
+ None ,
77
+ )
78
+ . await
73
79
}
74
80
Protocol :: Udp => {
75
81
stream_client:: connect_udp ( handshake, server. local_addr , & self . env , subscriber)
@@ -181,6 +187,8 @@ mod drop_handle {
181
187
}
182
188
183
189
pub mod server {
190
+ use std:: time:: Duration ;
191
+
184
192
use super :: * ;
185
193
186
194
#[ derive( Clone ) ]
@@ -201,6 +209,7 @@ pub mod server {
201
209
flavor : accept:: Flavor ,
202
210
protocol : Protocol ,
203
211
map_capacity : usize ,
212
+ linger : Option < Duration > ,
204
213
subscriber : event:: testing:: Subscriber ,
205
214
}
206
215
@@ -211,6 +220,7 @@ pub mod server {
211
220
flavor : accept:: Flavor :: default ( ) ,
212
221
protocol : Protocol :: Tcp ,
213
222
map_capacity : 16 ,
223
+ linger : None ,
214
224
subscriber : event:: testing:: Subscriber :: no_snapshot ( ) ,
215
225
}
216
226
}
@@ -255,6 +265,11 @@ pub mod server {
255
265
self
256
266
}
257
267
268
+ pub fn linger ( mut self , linger : Duration ) -> Self {
269
+ self . linger = Some ( linger) ;
270
+ self
271
+ }
272
+
258
273
pub fn subscriber ( mut self , subscriber : event:: testing:: Subscriber ) -> Self {
259
274
self . subscriber = subscriber;
260
275
self
@@ -266,6 +281,7 @@ pub mod server {
266
281
flavor,
267
282
protocol,
268
283
map_capacity,
284
+ linger,
269
285
subscriber,
270
286
} = self ;
271
287
@@ -291,7 +307,7 @@ pub mod server {
291
307
let socket = tokio:: net:: TcpListener :: from_std ( socket) . unwrap ( ) ;
292
308
293
309
let acceptor = stream_server:: tcp:: Acceptor :: new (
294
- 0 , socket, & sender, & env, & map, backlog, flavor, subscriber,
310
+ 0 , socket, & sender, & env, & map, backlog, flavor, linger , subscriber,
295
311
) ;
296
312
let acceptor = drop_handle_receiver. wrap ( acceptor. run ( ) ) ;
297
313
let acceptor = acceptor. instrument ( tracing:: info_span!( "tcp" ) ) ;
0 commit comments