Skip to content

Commit

Permalink
build:update rust deps
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Jun 21, 2024
1 parent 6a84f6c commit 22b8f54
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions gdrust/Cargo.lock

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

8 changes: 5 additions & 3 deletions gdrust/src/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream;
use tokio::sync::mpsc;

use crate::{get_multi_single, get_tokio_runtime};
use crate::{get_multi_single, get_tokio_runtime, MultiSingle};

pub struct MultiPlayerConnection {}

Expand All @@ -34,10 +34,12 @@ impl MultiManagerImpl {
// self.socket = Some(Arc::new(Mutex::new(TcpStream::from_std(
// std::net::TcpStream::connect(&ip)?,
// )?)));
let socket = std::net::TcpStream::connect(&ip)?;
let (sender, mut receiver) = mpsc::channel(32);
self.socket = Some(sender);
get_tokio_runtime().spawn(async move {
let mut socket = TcpStream::connect(&ip).await?;
// let mut socket = TcpStream::connect(&ip).await?;
let mut socket = TcpStream::from_std(socket)?;
while let Some(data) = receiver.recv().await {
socket.write_all(&data).await?;
}
Expand Down Expand Up @@ -83,7 +85,7 @@ impl MultiManagerImpl {
#[class(base = Node)]
pub struct MultiManager {
base: Base<Node>,
multi_impl: Arc<Mutex<MultiManagerImpl>>,
multi_impl: MultiSingle,
}

#[godot_api()]
Expand Down
2 changes: 1 addition & 1 deletion scripts/multi_game/enter.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends MultiEnter

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down
2 changes: 1 addition & 1 deletion scripts/start/multi_game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends Button

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down

0 comments on commit 22b8f54

Please sign in to comment.