Skip to content

Commit

Permalink
Allow connecting by hostname (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
spetz authored Jul 1, 2024
1 parent a6230e8 commit 99c9363
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iggy"
version = "0.4.3"
version = "0.4.4"
description = "Iggy is the persistent message streaming platform written in Rust, supporting QUIC, TCP and HTTP transport protocols, capable of processing millions of messages per second."
edition = "2021"
license = "MIT"
Expand Down
7 changes: 1 addition & 6 deletions sdk/src/tcp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::tcp::config::TcpClientConfig;
use async_trait::async_trait;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use std::fmt::Debug;
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader, BufWriter};
Expand All @@ -26,7 +25,6 @@ const NAME: &str = "Iggy";
/// It requires a valid server address.
#[derive(Debug)]
pub struct TcpClient {
pub(crate) server_address: SocketAddr,
pub(crate) stream: Mutex<Option<Box<dyn ConnectionStream>>>,
pub(crate) config: Arc<TcpClientConfig>,
pub(crate) state: Mutex<ClientState>,
Expand Down Expand Up @@ -196,11 +194,8 @@ impl TcpClient {

/// Create a new TCP client based on the provided configuration.
pub fn create(config: Arc<TcpClientConfig>) -> Result<Self, IggyError> {
let server_address = config.server_address.parse::<SocketAddr>()?;

Ok(Self {
config,
server_address,
stream: Mutex::new(None),
state: Mutex::new(ClientState::Disconnected),
})
Expand Down Expand Up @@ -276,7 +271,7 @@ impl TcpClient {
NAME, self.config.server_address
);

let connection = TcpStream::connect(self.server_address).await;
let connection = TcpStream::connect(&self.config.server_address).await;
if connection.is_err() {
error!(
"Failed to connect to server: {}",
Expand Down

0 comments on commit 99c9363

Please sign in to comment.