Skip to content

Commit

Permalink
0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
wei-rong-1 committed Nov 18, 2024
1 parent 1676c4a commit 0d6faa6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "node-vsock"
version = "0.0.4"
version = "0.0.5"

[lib]
crate-type = ["cdylib"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-vsock",
"version": "0.0.4",
"version": "0.0.5",
"description": "A Node.js addon for VSOCK socket.",
"main": "index.js",
"types": "index.d.ts",
Expand Down
9 changes: 0 additions & 9 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,9 @@ impl VsockSocket {
let emit_connection = self.thread_safe_emit_connection()?;

thread::spawn(move || loop {
println!("rs before accept");

let fd = match accept(server_fd) {
Ok(fd) => fd,
Err(err) => {
println!("rs accept err {0}", err);

emit_error.call(
Ok(format!("Accept connection failed: {0}", err)),
ThreadsafeFunctionCallMode::Blocking,
Expand All @@ -95,8 +91,6 @@ impl VsockSocket {
}
};

println!("rs accept emit");

emit_connection.call(Ok(fd), ThreadsafeFunctionCallMode::Blocking);
});

Expand Down Expand Up @@ -204,8 +198,6 @@ impl VsockSocket {
let emit_end = self.thread_safe_emit_end()?;

thread::spawn(move || loop {
println!("rs before recv length");

let mut buf: Vec<u8> = vec![0u8; BUF_MAX_LEN];
let mut ret: i32 = -1;
let mut ret_err = Errno::UnknownErrno;
Expand All @@ -228,7 +220,6 @@ impl VsockSocket {
Ordering::Greater => {
let size = ret as usize;
let buf = buf[0..size].to_vec();
println!("rs emit data {0}", String::from_utf8(buf.clone()).unwrap());
emit_data.call(Ok(buf), ThreadsafeFunctionCallMode::Blocking);
}
Ordering::Less => {
Expand Down

0 comments on commit 0d6faa6

Please sign in to comment.