File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -29,15 +29,15 @@ use ssl::SslMethod::Dtlsv1;
29
29
#[ cfg( feature="dtlsv1" ) ]
30
30
use connected_socket:: Connect ;
31
31
32
- #[ cfg( test ) ]
32
+ #[ cfg( feature = "dtlsv1" ) ]
33
33
mod udp {
34
- static mut udp_port: u16 = 15410 ;
34
+ use std:: sync:: atomic:: { AtomicUsize , ATOMIC_USIZE_INIT , Ordering } ;
35
+
36
+ static UDP_PORT : AtomicUsize = ATOMIC_USIZE_INIT ;
35
37
36
38
pub fn next_server < ' a > ( ) -> String {
37
- unsafe {
38
- udp_port += 1 ;
39
- format ! ( "127.0.0.1:{}" , udp_port)
40
- }
39
+ let diff = UDP_PORT . fetch_add ( 1 , Ordering :: SeqCst ) ;
40
+ format ! ( "127.0.0.1:{}" , 15411 + diff)
41
41
}
42
42
}
43
43
@@ -60,13 +60,13 @@ macro_rules! run_test(
60
60
use crypto:: hash:: Type :: SHA256 ;
61
61
use x509:: X509StoreContext ;
62
62
use serialize:: hex:: FromHex ;
63
-
63
+
64
64
#[ test]
65
65
fn sslv23( ) {
66
66
let stream = TcpStream :: connect( "127.0.0.1:15418" ) . unwrap( ) ;
67
67
$blk( SslMethod :: Sslv23 , stream) ;
68
68
}
69
-
69
+
70
70
#[ test]
71
71
#[ cfg( feature="dtlsv1" ) ]
72
72
fn dtlsv1( ) {
You can’t perform that action at this time.
0 commit comments