Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make source tcp listener address configurable #260

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ All other sections are for end-users.

- (Breaking Change) Remove `TimedStream` from foreign-service ([#250](https://github.com/SpringQL/SpringQL/pull/250)

### Fixed
- Make TCP server source address configurable, set it to "0.0.0.0" per default ([#260](https://github.com/SpringQL/SpringQL/pull/260))

## [v0.18.1] - 2022-10-07

### For developers
Expand Down
2 changes: 1 addition & 1 deletion springql-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "springql-core"
version = "0.18.1"
version = "0.18.2"

authors = ["Sho Nakatani <lay.sakura@gmail.com>"]
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 2 additions & 0 deletions springql-core/src/api/spring_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ timeout_msec = 3_000
[source_reader]
net_connect_timeout_msec = 1_000
net_read_timeout_msec = 100
net_address = "0.0.0.0"

can_read_timeout_msec = 100

Expand Down Expand Up @@ -179,6 +180,7 @@ pub struct SpringWebConsoleConfig {
pub struct SpringSourceReaderConfig {
pub net_connect_timeout_msec: u32,
pub net_read_timeout_msec: u32,
pub net_address: String,
AntonOellerer marked this conversation as resolved.
Show resolved Hide resolved

pub can_read_timeout_msec: u32,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl SourceReader for NetServerSourceReader {
"unsupported protocol"
);

let listener = TcpListener::bind(("127.0.0.1", options.port)).unwrap();
let listener = TcpListener::bind((config.net_address.clone(), options.port)).unwrap();
let my_addr = listener.local_addr().unwrap();

let (tx, rx) = mpsc::channel();
Expand Down Expand Up @@ -94,10 +94,10 @@ impl NetServerSourceReader {
}

fn stream_handler(stream: TcpStream, tx: mpsc::Sender<serde_json::Value>) {
log::info!(
"[NetServerSourceReader] Connection from {}",
stream.peer_addr().unwrap()
);
// log::info!(
// "[NetServerSourceReader] Connection from {}",
// stream.peer_addr().unwrap()
// );

let mut tcp_reader = BufReader::new(stream);

Expand Down