From a04f3246c1eda7b8d8d83ba2bcc46d502b80d22b Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 18 Sep 2018 14:27:27 +0200 Subject: Consolidate distribution entry state transitions * Make connection_id part of the distribution handle as {ConnId, DistEntry} in order for BIFs to verify correct connection. * Make distribution handle opaque to net_kernel. * Remove some unsafe lockless reads of DistEntry.flags * Change state ERTS_DE_STATE_EXITING to be more of an internal state that prevents erts from enqueue, encode or schedule new data to be sent. Otherwise it should behave like ERTS_DE_STATE_CONNECTED. --- erts/emulator/beam/io.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'erts/emulator/beam/io.c') diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index 133ab485d9..99d75a93ef 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -6172,6 +6172,7 @@ int driver_output_binary(ErlDrvPort ix, char* hbuf, ErlDrvSizeT hlen, erts_atomic64_inc_nob(&prt->dist_entry->in); return erts_net_message(prt, prt->dist_entry, + prt->connection_id, (byte*) hbuf, hlen, (byte*) (bin->orig_bytes+offs), len); } @@ -6214,11 +6215,13 @@ int driver_output2(ErlDrvPort ix, char* hbuf, ErlDrvSizeT hlen, if (len == 0) return erts_net_message(prt, prt->dist_entry, + prt->connection_id, NULL, 0, (byte*) hbuf, hlen); else return erts_net_message(prt, prt->dist_entry, + prt->connection_id, (byte*) hbuf, hlen, (byte*) buf, len); } -- cgit v1.2.3