From b31750711daa35011c62898d2eb424332e170bcc Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Thu, 1 Mar 2018 16:36:17 +0100 Subject: erts: Refactor DistEntry.status flags into a state Just to simplify and get 4 distinctive states IDLE, PENDING, CONNECTED and EXITING. The old possible flag combos were: 0 PENDING CONNECTED CONNECTED|EXITING EXITING The two EXITING states did not serve any purpose other then as a slight optimization in monitor_node(_,false,_) to shortcut EXITING when there can be no monitors. --- erts/emulator/beam/erl_node_tables.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'erts/emulator/beam/erl_node_tables.h') diff --git a/erts/emulator/beam/erl_node_tables.h b/erts/emulator/beam/erl_node_tables.h index 5822f97f55..58279017c8 100644 --- a/erts/emulator/beam/erl_node_tables.h +++ b/erts/emulator/beam/erl_node_tables.h @@ -57,9 +57,12 @@ #define ERST_INTERNAL_CHANNEL_NO 0 -#define ERTS_DE_SFLG_PENDING (((Uint32) 1) << 0) -#define ERTS_DE_SFLG_CONNECTED (((Uint32) 1) << 1) -#define ERTS_DE_SFLG_EXITING (((Uint32) 1) << 2) +enum dist_entry_state { + ERTS_DE_STATE_IDLE, + ERTS_DE_STATE_PENDING, + ERTS_DE_STATE_CONNECTED, + ERTS_DE_STATE_EXITING +}; #define ERTS_DE_QFLG_BUSY (((erts_aint32_t) 1) << 0) #define ERTS_DE_QFLG_EXIT (((erts_aint32_t) 1) << 1) @@ -122,7 +125,7 @@ typedef struct dist_entry_ { Eterm cid; /* connection handler (pid or port), NIL == free */ Uint32 connection_id; /* Connection id incremented on connect */ - Uint32 status; /* Slot status, like exiting reserved etc */ + enum dist_entry_state state; Uint32 flags; /* Distribution flags, like hidden, atom cache etc. */ unsigned long version; /* Protocol version */ -- cgit v1.2.1