@@ -7,10 +7,11 @@ extern crate url;
77extern crate openssl;
88
99use openssl:: ssl:: SslContext ;
10- use openssl:: ssl:: SslMethod :: Sslv3 ;
10+ use openssl:: ssl:: SslMethod ;
1111use std:: io:: { IoError , IoErrorKind } ;
1212use std:: io:: timer;
1313use std:: time:: Duration ;
14+ use std:: thread:: Thread ;
1415
1516use postgres:: { NoticeHandler ,
1617 Notification ,
@@ -623,7 +624,7 @@ fn test_notifications_next_block() {
623624 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
624625 or_panic ! ( conn. execute( "LISTEN test_notifications_next_block" , & [ ] ) ) ;
625626
626- spawn ( || {
627+ let _t = Thread :: spawn ( || {
627628 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
628629 timer:: sleep ( Duration :: milliseconds ( 500 ) ) ;
629630 or_panic ! ( conn. execute( "NOTIFY test_notifications_next_block, 'foo'" , & [ ] ) ) ;
@@ -642,7 +643,7 @@ fn test_notifications_next_block_for() {
642643 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
643644 or_panic ! ( conn. execute( "LISTEN test_notifications_next_block_for" , & [ ] ) ) ;
644645
645- spawn ( || {
646+ let _t = Thread :: spawn ( || {
646647 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
647648 timer:: sleep ( Duration :: milliseconds ( 500 ) ) ;
648649 or_panic ! ( conn. execute( "NOTIFY test_notifications_next_block_for, 'foo'" , & [ ] ) ) ;
@@ -661,7 +662,7 @@ fn test_notifications_next_block_for_timeout() {
661662 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
662663 or_panic ! ( conn. execute( "LISTEN test_notifications_next_block_for_timeout" , & [ ] ) ) ;
663664
664- spawn ( || {
665+ let _t = Thread :: spawn ( || {
665666 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
666667 timer:: sleep ( Duration :: seconds ( 2 ) ) ;
667668 or_panic ! ( conn. execute( "NOTIFY test_notifications_next_block_for_timeout, 'foo'" , & [ ] ) ) ;
@@ -683,7 +684,7 @@ fn test_cancel_query() {
683684 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
684685 let cancel_data = conn. cancel_data ( ) ;
685686
686- spawn ( move || {
687+ let _t = Thread :: spawn ( move || {
687688 timer:: sleep ( Duration :: milliseconds ( 500 ) ) ;
688689 assert ! ( postgres:: cancel_query( "postgres://postgres@localhost" , & SslMode :: None ,
689690 cancel_data) . is_ok( ) ) ;
@@ -698,15 +699,15 @@ fn test_cancel_query() {
698699
699700#[ test]
700701fn test_require_ssl_conn ( ) {
701- let ctx = SslContext :: new ( Sslv3 ) . unwrap ( ) ;
702+ let ctx = SslContext :: new ( SslMethod :: Sslv23 ) . unwrap ( ) ;
702703 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" ,
703704 & SslMode :: Require ( ctx) ) ) ;
704705 or_panic ! ( conn. execute( "SELECT 1::VARCHAR" , & [ ] ) ) ;
705706}
706707
707708#[ test]
708709fn test_prefer_ssl_conn ( ) {
709- let ctx = SslContext :: new ( Sslv3 ) . unwrap ( ) ;
710+ let ctx = SslContext :: new ( SslMethod :: Sslv23 ) . unwrap ( ) ;
710711 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" ,
711712 & SslMode :: Prefer ( ctx) ) ) ;
712713 or_panic ! ( conn. execute( "SELECT 1::VARCHAR" , & [ ] ) ) ;
0 commit comments