Skip to content

Commit

Permalink
Rename net_listen() parameter
Browse files Browse the repository at this point in the history
For consistency with net_accept(), which necessarily uses a server
socket, name the net_listen() parameter "server_socket".
  • Loading branch information
rom1v committed Aug 17, 2022
1 parent d23b3e8 commit d19606e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/src/util/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ net_connect(sc_socket socket, uint32_t addr, uint16_t port) {
}

bool
net_listen(sc_socket socket, uint32_t addr, uint16_t port, int backlog) {
sc_raw_socket raw_sock = unwrap(socket);
net_listen(sc_socket server_socket, uint32_t addr, uint16_t port, int backlog) {
sc_raw_socket raw_sock = unwrap(server_socket);

int reuse = 1;
if (setsockopt(raw_sock, SOL_SOCKET, SO_REUSEADDR, (const void *) &reuse,
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool
net_connect(sc_socket socket, uint32_t addr, uint16_t port);

bool
net_listen(sc_socket socket, uint32_t addr, uint16_t port, int backlog);
net_listen(sc_socket server_socket, uint32_t addr, uint16_t port, int backlog);

sc_socket
net_accept(sc_socket server_socket);
Expand Down
6 changes: 3 additions & 3 deletions app/src/util/net_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ net_connect_intr(struct sc_intr *intr, sc_socket socket, uint32_t addr,
}

bool
net_listen_intr(struct sc_intr *intr, sc_socket socket, uint32_t addr,
net_listen_intr(struct sc_intr *intr, sc_socket server_socket, uint32_t addr,
uint16_t port, int backlog) {
if (!sc_intr_set_socket(intr, socket)) {
if (!sc_intr_set_socket(intr, server_socket)) {
// Already interrupted
return false;
}

bool ret = net_listen(socket, addr, port, backlog);
bool ret = net_listen(server_socket, addr, port, backlog);

sc_intr_set_socket(intr, SC_SOCKET_NONE);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/net_intr.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ net_connect_intr(struct sc_intr *intr, sc_socket socket, uint32_t addr,
uint16_t port);

bool
net_listen_intr(struct sc_intr *intr, sc_socket socket, uint32_t addr,
net_listen_intr(struct sc_intr *intr, sc_socket server_socket, uint32_t addr,
uint16_t port, int backlog);

sc_socket
Expand Down

0 comments on commit d19606e

Please sign in to comment.