diff --git a/Dockerfile b/Dockerfile index dfa5630..4a3d6e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM debian:bullseye AS builder WORKDIR /app/src/ RUN apt-get -y -q update -RUN apt-get -y -q install make binutils gcc libc-dev +RUN apt-get -y -q install make binutils gcc libc-dev tcpdump COPY . . RUN ./configure --prefix=/app RUN make clean all install clean @@ -11,6 +11,9 @@ FROM debian:bullseye WORKDIR /app COPY --from=builder /app /app -USER daemon:daemon +RUN apt-get -y -q update +RUN apt-get -y -q install tcpdump + +#USER daemon:daemon ENTRYPOINT ["/app/sbin/cworker"] diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 19ec1d4..2a4102b 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -1,5 +1,5 @@ apiVersion: apps/v1 -kind: Deployment +kind: StatefulSet metadata: name: cworker namespace: {{ .Release.Namespace }} diff --git a/cworker.c b/cworker.c index c1acdf3..1002263 100644 --- a/cworker.c +++ b/cworker.c @@ -322,7 +322,15 @@ int cworker_handler(const cworker_t* worker, int socket) { jblock_outjson(&jb, &jsonstr); jblock_destroy(&jb); - write(socket, jsonstr, strlen(jsonstr)); + size_t jsize = strlen(jsonstr); + ssize_t wsize = write(socket, jsonstr, jsize); + if (wsize < 0) { + log_error("Write error: %s", strerror(errno)); + } + if (wsize != jsize && wsize >= 0 ) { + log_error("Wrote only %ld from %ld", (size_t)wsize, jsize); + } + free(jsonstr); //free(name); free(msg);