Skip to content

Commit 13cd86c

Browse files
committed
A comment on raw fd
1 parent 515cd12 commit 13cd86c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/safeposix/syscalls/net_calls.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ impl Cage {
845845
);
846846
}
847847

848-
// ** Why do we not use sock_tmp as the arugment instead of sockfdobj, since sock_tmp is the clone?? ** //
849848
match sockhandle.protocol {
850849
IPPROTO_UDP => {
851850
return self.connect_udp(&mut *sockhandle, sockfdobj, remoteaddr)
@@ -991,7 +990,6 @@ impl Cage {
991990

992991
//NET_METADATA.domsock_paths is the set of all currently bound domain sockets
993992
//try to get and hold reference to the key-value pair, so other process can't alter it
994-
// ** How does the line below hold a reference to the key so other processes can't alter it ? ** //
995993
let path_ref = NET_METADATA.domsock_paths.get(&remotepathbuf);
996994
// if the entry doesn't exist, return an error.
997995
if path_ref.is_none() {
@@ -1028,6 +1026,7 @@ impl Cage {
10281026
NET_METADATA
10291027
.domsock_accept_table
10301028
.insert(remotepathbuf, entry);
1029+
// TODO: Add logics to handle nonblocking connects here
10311030
//Update the sock handle state to indicate that it is connected
10321031
sockhandle.state = ConnState::CONNECTED;
10331032
//If the socket is set to blocking mode, wait until a thread
@@ -1119,7 +1118,7 @@ impl Cage {
11191118
//the connection could not be established immediately.
11201119
//https://www.gnu.org/software/libc/manual/html_node/Connecting.html
11211120
// ** Another connect call on the same socket, before the connection is completely established,
1122-
//will fail with EALREADY. This doesn't seem to be implemented specifically **
1121+
// will fail with EALREADY. This doesn't seem to be implemented specifically **
11231122
Ok(i) => {
11241123
if i == Errno::EINPROGRESS {
11251124
inprogress = true;
@@ -1136,9 +1135,11 @@ impl Cage {
11361135
sockhandle.state = ConnState::CONNECTED;
11371136
sockhandle.remoteaddr = Some(remoteaddr.clone());
11381137
sockhandle.errno = 0;
1139-
// set the rawfd for select
1140-
// ** What does the above comment mean ?? ** //
1141-
//The raw fd of the socket is the set to be the same as the fd set by the kernal in the libc connect call
1138+
// Set the rawfd for select_syscall as we cannot implement the select
1139+
// logics for AF_INET socket right now, so we have to call the select
1140+
// syscall from libc, which takes the rawfd as the argument instead of
1141+
// the fake fd used by lind.
1142+
// The raw fd of the socket is the set to be the same as the fd set by the kernal in the libc connect call
11421143
// ** Will this ever cause issues of indexing into an fd that is already set by lind ?? ** //
11431144
sockfdobj.rawfd = sockhandle.innersocket.as_ref().unwrap().raw_sys_fd;
11441145
if inprogress {

0 commit comments

Comments
 (0)