Created
January 29, 2010 19:00
-
-
Save KirinDave/289987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ping_any_master(AllNodes) -> | |
| error_logger:info_msg("~nAttempting to connect to master via: ~p~n", [AllNodes]), | |
| [N|RN] = AllNodes, | |
| ping_any_master(N, RN, AllNodes). | |
| ping_any_master(N, [], AllNodes) -> | |
| ping_any_master(N, AllNodes, AllNodes); | |
| ping_any_master(N, RN, AllNodes) -> | |
| case net_adm:ping(N) of | |
| pong -> | |
| error_logger:info_msg("~nJoined cloud using candidate ~p.~n", [N]), | |
| timer:sleep(?SLEEP_CYCLE), | |
| ok; | |
| pang -> | |
| error_logger:info_msg("~nCould not reach master candidate ~p. Trying next in ~p~n", [N, ?SLEEP_CYCLE]), | |
| timer:sleep(?SLEEP_CYCLE), | |
| [N2|RN2] = RN, | |
| ping_any_master(N2, RN2, AllNodes) | |
| end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment