Fixed the neat_close() bug.
@@ -322,6 +322,16 @@ neat_free_ctx(struct neat_ctx *nc)
*/
assert(flow != prev_flow);
+ /* NEAT is shutting down. Make sure that close callback is called here,
+ * since there is no main loop any more. */
+ if (!flow->socket->multistream
+#ifdef SCTP_MULTISTREAMING
+ || flow->socket->sctp_streams_used == 0
+#endif
+ ) {
+ flow->closefx(flow->ctx, flow);
+ }
+
neat_free_flow(flow);
prev_flow = flow;
}
@@ -582,14 +592,6 @@ synchronous_free(neat_flow *flow)
assert(flow);
assert(flow->socket);
- if (!flow->socket->multistream
-#ifdef SCTP_MULTISTREAMING
- || flow->socket->sctp_streams_used == 0
-#endif
- ) {
- flow->closefx(flow->ctx, flow);
- }
-
free((char *)flow->name);
free((char *)flow->server_pem);
free((char *)flow->cert_pem);
