]> PatchyGit - patchyircd.git/commitdiff
job/netpoll: clean up remnants of the old SIGCHLD handling
authorEgor <egor@patchysicp.xyz>
Thu, 5 Jun 2025 13:38:35 +0000 (16:38 +0300)
committerEgor <egor@patchysicp.xyz>
Thu, 5 Jun 2025 13:38:35 +0000 (16:38 +0300)
src/job.cpp
src/job.h
src/main.cpp
src/netpoll.cpp
src/netpoll.h

index d8f2df4..4fcf160 100644 (file)
@@ -59,7 +59,7 @@ void job_fini(void)
        uv_close((uv_handle_t *)&uvsigchld, 0);
        uv_close((uv_handle_t *)&uvsigint, 0);
 }
-static void job_process(void)
+void job_process(void)
 {
        if (joblen && !jobtab[0].job && current_child == -1) {
                jobtab[0].then(jobtab[0].client, current_result);
@@ -84,14 +84,6 @@ static void job_process(void)
                }
        }
 }
-void job_process_begin(void)
-{
-       job_process();
-}
-void job_process_end(void)
-{
-       job_process();
-}
 
 void job_add(struct client_data *cl, jobproc_t job, contproc_t then, char *data, size_t len)
 {
index 90f926b..1da443a 100644 (file)
--- a/src/job.h
+++ b/src/job.h
@@ -6,8 +6,7 @@ typedef int (*jobproc_t)(struct client_data *cl, const char *data, size_t len);
 typedef void (*contproc_t)(struct client_data *cl, int res);
 void job_init(void);
 void job_fini(void);
-void job_process_begin(void);
-void job_process_end(void);
+void job_process(void);
 void job_add(struct client_data *client, jobproc_t job, contproc_t then, char *data, size_t len);
 void job_kill(struct client_data *client);
 void job_password_check(struct client_data *client, const char *key, const char *pw, const char *fn, contproc_t then);
index 4e736dc..bc558a6 100644 (file)
@@ -388,16 +388,10 @@ int main(int argc, char *argv[])
                                break;
                }
 
-               job_process_begin();
-               if (netpoll::begin() == -1) {
-                       if (errno == EINTR) {
-                               job_process_end();
-                               continue;
-                       }
-                       net_perror("ERROR SELECT");
-                       job_process_end();
-               }
-               job_process_end();
+               job_process();
+               netpoll::begin();
+               job_process();
+
                int ev;
                netpoll::net_pollfd pfd;
                while ((ev = netpoll::get(&pfd))) {
index 986c5d3..3de7569 100644 (file)
@@ -98,7 +98,7 @@ static void reg_impl(int i, int ev)
                events |= UV_WRITABLE;
        uvpoll[i]->events = events;
 }
-int begin(void)
+void begin(void)
 {
        for (int i = 0; i < nfds; i++) {
                if (uvpoll[i]->dead == 0) {
@@ -109,7 +109,6 @@ int begin(void)
                }
        }
        uv_run(uvloop, UV_RUN_ONCE);
-       return 0;
 }
 int get(struct net_pollfd *out)
 {
index 3326771..ecdf8f2 100644 (file)
@@ -15,7 +15,7 @@ void add(SOCKET fd, int type, void *assoc);
 void del_and_close(SOCKET fd);
 void reg(SOCKET fd, int ev);
 void change_type(SOCKET fd, int type);
-int begin(void);
+void begin(void);
 int get(struct net_pollfd *out);
 }
 #define NETPOLL_IN 1