Просмотр исходного кода

Change ranch_conns_sup update from supervisor to advanced

juhlig 5 лет назад
Родитель
Сommit
3ff117e9ab
1 измененных файлов с 15 добавлено и 2 удалено
  1. 15 2
      src/ranch.appup

+ 15 - 2
src/ranch.appup

@@ -1,3 +1,14 @@
+%% ranch_conns_sup is a custom supervisor (special process),
+%% not an OTP supervisor. When "supervisor" is used, the
+%% module is always loaded before calling system_code_change,
+%% for both upgrade and downgrade operations. This is so that
+%% the supervisor's init callback of the upgraded/downgraded
+%% module gets called. But the custom supervisors in Ranch
+%% do not have an init callback and therefore can function
+%% like other special processes: when upgrading, load the
+%% module then call system_code_change; and when downgrading,
+%% call system_code_change and then load the module.
+
 %% @todo Remove the ending .* before release, we do not
 %% want to support upgrades from/to release candidates.
 
@@ -8,7 +19,8 @@
 		{load_module, ranch_acceptor},
 		{update, ranch_acceptors_sup, supervisor},
 		{load_module, ranch_app},
-		{update, ranch_conns_sup, supervisor},
+		%% See comments at the top of the file about ranch_conns_sup.
+		{update, ranch_conns_sup, {advanced, []}},
 		{update, ranch_conns_sup_sup, supervisor},
 		{load_module, ranch_crc32c},
 		{update, ranch_embedded_sup, supervisor},
@@ -29,7 +41,8 @@
 		{load_module, ranch_acceptor},
 		{update, ranch_acceptors_sup, supervisor},
 		{load_module, ranch_app},
-		{update, ranch_conns_sup, supervisor},
+		%% See comments at the top of the file about ranch_conns_sup.
+		{update, ranch_conns_sup, {advanced, []}},
 		{update, ranch_conns_sup_sup, supervisor},
 		{load_module, ranch_crc32c},
 		{update, ranch_embedded_sup, supervisor},