Skip to content

Commit

Permalink
conn_sock: add function to close all readers
Browse files Browse the repository at this point in the history
Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Dec 22, 2020
1 parent e7e84a4 commit 43377e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/conn_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,16 @@ static void init_remote_sock(struct remote_sock_s *sock, struct remote_sock_s *s
sock->sock_type = src->sock_type;
}
}

static void close_sock(gpointer data, G_GNUC_UNUSED gpointer user_data)
{
struct remote_sock_s *sock = (struct remote_sock_s *)data;

close(sock->fd);
sock->fd = -1;
}

void close_all_readers()
{
g_ptr_array_foreach(local_mainfd_stdin.readers, close_sock, NULL);
}
1 change: 1 addition & 0 deletions src/conn_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ char *setup_attach_socket(void);
void setup_notify_socket(char *);
void schedule_main_stdin_write();
void write_back_to_remote_consoles(char *buf, int len);
void close_all_readers();

#endif // CONN_SOCK_H

0 comments on commit 43377e3

Please sign in to comment.