Skip to content

Commit

Permalink
Merge pull request #48 from beordle/feature/oneshot
Browse files Browse the repository at this point in the history
local_listen is supported in oneshot mode
  • Loading branch information
beordle authored Nov 2, 2023
2 parents 941ffd8 + 8472d07 commit 93064c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/portforward.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void portforward_transparent_server_pipe(port_listen_t *pe) {
static void portforward_service_handler(port_listen_t *pe) {
int new_sd;
int listen_fd = pe->local_fd;
// set_running_task_changed(1);
set_running_task_changed(1);
while (true) {
if ((new_sd = accept(listen_fd, NULL, NULL)) >= 0) {
pthread_t *worker = (pthread_t *)malloc(sizeof(pthread_t)); // TODO(jdz) free
Expand All @@ -298,7 +298,7 @@ static void portforward_service_handler(port_listen_t *pe) {
log_info("abort the accept");
}
}
// set_running_task_changed(-1);
set_running_task_changed(-1);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ actionfinder_t action_table[] = {
{"local_listen", portforward_func, "port forward bind on local host",
"local_listen [local_host] [local_port] [remote_host] [remote_port]\n"
"when remote_port==0, the service listen on remote_port will be a "
"socks5+http proxy server.", NULL},
"socks5+http proxy server.", FLAG_ONESHOT},
{"remote_listen", portforward_func, "port forward bind on remote host",
"remote_listen [remote_host] [remote_port] [local_host] [local_port]\n"
"when local_port==0, the service listen on remote_port will be a "
Expand Down

0 comments on commit 93064c4

Please sign in to comment.