diff options
author | Alexander Færøy <ahf@torproject.org> | 2018-11-28 21:55:04 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-12-17 16:39:28 -0500 |
commit | 5585cbd08f54f732c32feea276c1a47ec8446c5e (patch) | |
tree | 726a83a6ac0446247535e80856ad3f51a78e69b0 /src/feature/client/transports.c | |
parent | 22cb3c6ce9164920ff81013d5f8dce3c26911af4 (diff) | |
download | tor-5585cbd08f54f732c32feea276c1a47ec8446c5e.tar.gz tor-5585cbd08f54f732c32feea276c1a47ec8446c5e.zip |
Change the Process exit_callback to return bool.
This patch changes our process_t's exit_callback to return a boolean
value. If the returned value is true, the process subsystem will call
process_free() on the given process_t.
See: https://bugs.torproject.org/28179
Diffstat (limited to 'src/feature/client/transports.c')
-rw-r--r-- | src/feature/client/transports.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/feature/client/transports.c b/src/feature/client/transports.c index 0e326f90e9..e3cc679411 100644 --- a/src/feature/client/transports.c +++ b/src/feature/client/transports.c @@ -1759,8 +1759,9 @@ managed_proxy_stderr_callback(process_t *process, char *line, size_t size) /** Callback function that is called when our PT process terminates. The * process exit code can be found in <b>exit_code</b> and our process can be - * found in <b>process</b>. */ -STATIC void + * found in <b>process</b>. Returns true iff we want the process subsystem to + * free our process_t handle for us. */ +STATIC bool managed_proxy_exit_callback(process_t *process, process_exit_code_t exit_code) { tor_assert(process); @@ -1772,10 +1773,14 @@ managed_proxy_exit_callback(process_t *process, process_exit_code_t exit_code) /* We detach ourself from the MP (if we are attached) and free ourself. */ managed_proxy_t *mp = process_get_data(process); + /* If we are still attached to the process, it is probably because our PT + * process crashed before we got to call process_set_data(p, NULL); */ if (BUG(mp != NULL)) { + /* FIXME(ahf): Our process stopped without us having told it to stop + * (crashed). Should we restart it here? */ mp->process = NULL; process_set_data(process, NULL); } - process_free(process); + return true; } |