From: Gianmarco De Gregori <[email protected]> multi_process_file_closed() is the last place where multi_process_post() runs without a multi_io_action() following it, so any output it produces stays in m->pending across event_wait().
Add TA_INSTANCE_POST, which only runs multi_process_post() on the given instance, and use it so pending output is flushed as for every other event. Likewise, an instance signalled during this post-processing is now closed right away instead of on its next event. This is needed before m->pending can be removed. Change-Id: I49777902951d3a05c48cddd0d33c14e028e5d706 Signed-off-by: Gianmarco De Gregori <[email protected]> Acked-by: Razvan Cojocaru <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2047 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2047 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru <[email protected]> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 3f82052..b1a648b 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2841,7 +2841,7 @@ * (or be deferred again by client-connect) */ void -multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags) +multi_process_file_closed(struct multi_context *m) { char buffer[INOTIFY_EVENT_BUFFER_SIZE]; ssize_t buffer_i = 0; @@ -2869,7 +2869,7 @@ if (mi) { /* continue authentication, perform NCP negotiation and send push_reply */ - multi_process_post(m, mi, mpp_flags); + multi_io_action(m, mi, TA_INSTANCE_POST, false); } else { diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 3d2e932..4a93971 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -382,9 +382,8 @@ * Continues authentication and sends push_repl * * @param m multi_context - * @param mpp_flags */ -void multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags); +void multi_process_file_closed(struct multi_context *m); #endif diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index fb4810b..a6e97af 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -85,6 +85,9 @@ case TA_TUN_WRITE_TIMEOUT: return "TA_TUN_WRITE_TIMEOUT"; + case TA_INSTANCE_POST: + return "TA_INSTANCE_POST"; + default: return "?"; } @@ -492,6 +495,11 @@ multi_process_post(m, mi, mpp_flags); break; + case TA_INSTANCE_POST: + ASSERT(mi); + multi_process_post(m, mi, mpp_flags); + break; + default: msg(M_FATAL, "MULTI IO: multi_io_dispatch, unhandled action=%d", action); } @@ -659,7 +667,7 @@ #ifdef ENABLE_ASYNC_PUSH else if (e->arg == MULTI_IO_FILE_CLOSE_WRITE) { - multi_process_file_closed(m, MPP_PRE_SELECT | MPP_RECORD_TOUCH); + multi_process_file_closed(m); } #endif } diff --git a/src/openvpn/multi_io.h b/src/openvpn/multi_io.h index c7f8f89..4d56e25 100644 --- a/src/openvpn/multi_io.h +++ b/src/openvpn/multi_io.h @@ -44,6 +44,7 @@ #define TA_INITIAL 8 #define TA_TIMEOUT 9 #define TA_TUN_WRITE_TIMEOUT 10 +#define TA_INSTANCE_POST 11 /* * I/O state and events tracker _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
