Skip to content

Commit

Permalink
Merge pull request #454 from nworbnhoj/main
Browse files Browse the repository at this point in the history
replace TcpStream::connect(&str) with TcpStream::connect((&str, u16))
  • Loading branch information
bunnie authored Nov 30, 2023
2 parents b255468 + e8e8757 commit 0542f85
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions libs/tls/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ pub fn shellchat<'a>(
.unwrap();

log::info!("connect TCPstream to {}", target);
let url = format!("{}:443", target);
match TcpStream::connect(url) {
match TcpStream::connect((target, 443)) {
Ok(mut sock) => {
log::info!("tcp connected");
write!(ret, "{}", t!("tls.test_success_tcp", locales::LANG)).ok();
Expand Down
3 changes: 1 addition & 2 deletions libs/tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ impl Tls {
let mut conn =
rustls::ClientConnection::new(Arc::new(config), server_name).unwrap();
log::info!("connect TCPstream to {}", target);
let url = format!("{}:443", target);
match TcpStream::connect(url) {
match TcpStream::connect((target, 443)) {
Ok(mut sock) => {
match conn.complete_io(&mut sock) {
Ok(_) => log::info!("handshake complete"),
Expand Down
2 changes: 1 addition & 1 deletion services/net/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn bind_error() {

#[test]
fn connect_error() {
match TcpStream::connect("0.0.0.0:1") {
match TcpStream::connect(("0.0.0.0",1)) {
Ok(..) => panic!(),
Err(e) => assert!(
e.kind() == ErrorKind::ConnectionRefused
Expand Down
2 changes: 1 addition & 1 deletion services/shellchat/src/nettests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn bind_error() {
}

fn connect_error() {
match TcpStream::connect("0.0.0.0:1") {
match TcpStream::connect(("0.0.0.0",1)) {
Ok(..) => panic!(),
Err(e) => {
log::info!("connect_error is {:?}", e);
Expand Down

0 comments on commit 0542f85

Please sign in to comment.