Skip to content

Commit

Permalink
Replacing Tokio's TcpStream with async-std TcpStream (#475)
Browse files Browse the repository at this point in the history
* adding trace logs to every function call.
adding trace logs for the stream's readiness to read data

* adding trace logs for ready status

* show peer_addr and local_addr

* adding std::net::TcpStream

* convert std::net::TcpStream to tokio

* completely change tokio to std::net

* code cleanup, ready for review

* remove unnecessary features of tokio

* from async to just normal funcs

* testing fixes for test not stopping

* set timeout for tests to 180

* fixes warnings

* Replace tokio's TcpStream with async-std (#481)

* async-std

* works, but still in progress

* working test withouth extra signals

* remove comments and re-add connector drop trait

* cleanup

* fix the failing test about current slot

* fix the failing test about current slot, by connecting to specifically different nodes

* update config files

* use a different account for testing

* fix rustfmt

---------

Co-authored-by: Gianfranco <[email protected]>

---------

Co-authored-by: Gianfranco Tasteri <[email protected]>
Co-authored-by: Gianfranco <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent 386026e commit 56b9601
Show file tree
Hide file tree
Showing 19 changed files with 341 additions and 207 deletions.
119 changes: 119 additions & 0 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions clients/stellar-relay-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ err-derive = "0.3.1"
tokio = { version = "1.0", features = [
"macros", # allows main function to be async
"rt-multi-thread", # for multi-thread runtime
"net", # contains the TcpStream
"sync", # to make channels available
"io-util", # for async read/write operations
"time" # for timeouts and sleep, when reconnecting
] }
async-std = { version = "1.12.0", features = ["attributes"] }

[features]
std = [
Expand Down
2 changes: 1 addition & 1 deletion clients/stellar-relay-lib/examples/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let mut overlay_connection = connect_to_stellar_overlay_network(cfg, &secret_key).await?;

while let Ok(Some(msg)) = overlay_connection.listen().await {
while let Ok(Some(msg)) = overlay_connection.listen() {
match msg {
StellarMessage::ScpMessage(msg) => {
let node_id = msg.statement.node_id.to_encoding();
Expand Down
Loading

0 comments on commit 56b9601

Please sign in to comment.