Skip to content

Commit

Permalink
standalone-enc: more clean up
Browse files Browse the repository at this point in the history
This should have been part of:
    2022-02-19 standalone-enc: clean up
    a27c087

No need to keep the cancel_cookie inside the pipe cookie.
  • Loading branch information
gperciva authored and cperciva committed Aug 24, 2022
1 parent f2abbca commit b1ff4e8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions perftests/standalone-enc/standalone_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/* Cookie for proto_pipe */
struct pipe {
struct proto_keys * k;
void * cancel_cookie;
pthread_t enc_thr;
pthread_t output_thr;
int in[2];
Expand Down Expand Up @@ -55,16 +54,20 @@ static void *
pipe_enc_thread(void * cookie)
{
struct pipe * pipe = cookie;
void * cancel_cookie;

/* Create the pipe. */
if ((pipe->cancel_cookie = proto_pipe(pipe->in[1], pipe->out[0], 0,
if ((cancel_cookie = proto_pipe(pipe->in[1], pipe->out[0], 0,
pipe->k, &pipe->status, pipe_callback_status, pipe)) == NULL)
warn0("proto_pipe");

/* Let events happen. */
if (events_spin(&pipe->done))
warnp("events_spin");

/* Clean up the pipe. */
proto_pipe_cancel(cancel_cookie);

/* Finished! */
return (NULL);
}
Expand Down Expand Up @@ -165,7 +168,7 @@ pipe_func(void * cookie, uint8_t * buf, size_t buflen, size_t nreps)

/* We've finished writing stuff. */
if (shutdown(pipe->in[0], SHUT_WR)) {
warnp("close");
warnp("shutdown");
goto err0;
}

Expand Down Expand Up @@ -199,7 +202,6 @@ pipe_cleanup(void * cookie)
struct pipe * pipe = cookie;

/* Clean up. */
proto_pipe_cancel(pipe->cancel_cookie);
proto_crypt_free(pipe->k);

/* Success! */
Expand Down

0 comments on commit b1ff4e8

Please sign in to comment.