Skip to content

Commit 1bbfc2c

Browse files
committed
Addressing reviewer comments
1 parent 21ff605 commit 1bbfc2c

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

fortanix-vme/fortanix-vme-abi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ compiler_builtins = { version = "0.1.0", optional = true }
1414
serde = { git = "https://github.com/fortanix/serde.git", branch = "master", default-features = false, features = ["derive", "alloc"] }
1515

1616
[features]
17-
std = []
18-
default = []
17+
std = ["serde/std"]
18+
default = ["std"]
1919
docs = []
2020
rustc-dep-of-std = ["core", "alloc", "compiler_builtins/rustc-dep-of-std", "serde/rustc-dep-of-std"]

fortanix-vme/fortanix-vme-abi/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub enum Request {
1616
addr: String,
1717
},
1818
Bind {
19-
/// The address the listen on in the parent VM
19+
/// The address the listen to in the parent VM
2020
addr: String,
2121
/// The port the enclave is listening on to receive connections from the parent VM
2222
enclave_port: u32,
@@ -68,7 +68,7 @@ pub enum Response {
6868
proxy_port: u32,
6969
},
7070
Bound {
71-
/// The TCP port the runner is listening on
71+
/// The TCP port the parent VM is listening on
7272
port: u16,
7373
/// The id used to identify the listener. It can be used for subsequent calls (e.g., to
7474
/// accept new incoming connections)
@@ -78,12 +78,11 @@ pub enum Response {
7878
/// The address of the remote party
7979
peer: Addr,
8080
/// The vsock port number the runner will connect to the enclave in order to forward the
81-
/// incomming connection
81+
/// incoming connection
8282
proxy_port: u32,
8383
}
8484
}
8585

86-
/*
8786
#[cfg(test)]
8887
mod test {
8988
use std::net::{IpAddr, SocketAddr};
@@ -101,4 +100,3 @@ mod test {
101100
}
102101
}
103102
}
104-
*/

fortanix-vme/fortanix-vme-runner/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use fnv::FnvHashMap;
22
use nix::sys::select::{select, FdSet};
3-
use nix::sys::socket::SockAddr as NixSockAddr;
43
use serde_cbor;
54
use std::cmp;
65
use std::str;
@@ -215,7 +214,7 @@ impl Server {
215214
}
216215

217216
fn listener_info(&self, fd: &RawFd) -> Option<Arc<Mutex<ListenerInfo>>> {
218-
self.listeners.lock().unwrap().get(&fd).map(|m| m.clone())
217+
self.listeners.lock().unwrap().get(&fd).cloned()
219218
}
220219

221220
/*
@@ -260,7 +259,8 @@ impl Server {
260259
}
261260

262261
fn handle_request_accept(&self, fd: RawFd, enclave: &mut VsockStream) -> Result<(), IoError> {
263-
let listener_info = self.listener_info(&fd).unwrap();
262+
let listener_info = self.listener_info(&fd)
263+
.ok_or(IoError::new(IoErrorKind::InvalidInput, "Information about provided file descriptor was not found"))?;
264264
let listener_info = listener_info.lock().unwrap();
265265
let (cid, port) = (listener_info.enclave_cid, listener_info.enclave_port);
266266
match listener_info.listener.accept() {

0 commit comments

Comments
 (0)