diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-25 16:58:38 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-08-26 04:05:02 +0200 |
commit | 532b3ae9b5cd8609237e04db768cc1f750d8631d (patch) | |
tree | f65253a6ce9970d1d93e6bb6c65758d6fa98373a /src/server.h | |
parent | cmake: ignore unused parameters for now (diff) | |
download | cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.tar.gz cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.zip |
add some more code
This adds a basic "worker" program.
You can now do something like
./server &
./worker &
./client ci_run URL REV
and the server should pass a message to worker, after which it should
clone the repository at URL, checkout REV, and try to run the CI script.
It's extremely unfinished: I need to sort out the graceful shutdown, how
the server manages workers, etc.
Diffstat (limited to 'src/server.h')
-rw-r--r-- | src/server.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/server.h b/src/server.h index 11c409b..37fdb13 100644 --- a/src/server.h +++ b/src/server.h @@ -1,7 +1,11 @@ #ifndef __SERVER_H__ #define __SERVER_H__ +#include "ci_queue.h" #include "tcp_server.h" +#include "worker_queue.h" + +#include <pthread.h> struct settings { const char *port; @@ -9,11 +13,21 @@ struct settings { struct server { struct tcp_server tcp_server; + + struct worker_queue worker_queue; + struct ci_queue ci_queue; + + pthread_mutex_t scheduler_mtx; + pthread_cond_t scheduler_cv; + pthread_t scheduler; }; int server_create(struct server *, const struct settings *); -void server_destroy(const struct server *); +void server_destroy(struct server *); + +int server_main(struct server *); -int server_main(const struct server *); +int server_new_worker(struct server *, int fd); +int server_ci_run(struct server *, const char *url, const char *rev); #endif |