Fixes to -R feature

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-06-25 21:14:03 +00:00
parent c9f168ed0f
commit 9ab74af94f

View File

@@ -58,6 +58,10 @@
#define AST_MAX_CONNECTS 128 #define AST_MAX_CONNECTS 128
#define NUM_MSGS 64 #define NUM_MSGS 64
#define WELCOME_MESSAGE ast_verbose( "Asterisk " ASTERISK_VERSION ", Copyright (C) 1999-2004 Digium.\n"); \
ast_verbose( "Written by Mark Spencer <markster@digium.com>\n"); \
ast_verbose( "=========================================================================\n")
int option_verbose=0; int option_verbose=0;
int option_debug=0; int option_debug=0;
int option_nofork=0; int option_nofork=0;
@@ -876,15 +880,13 @@ static int ast_el_read_char(EditLine *el, char *cp)
quit_handler(0, 0, 0, 0); quit_handler(0, 0, 0, 0);
} else { } else {
int tries; int tries;
int reconnects_per_second = 10; int reconnects_per_second = 20;
fprintf(stderr, "\nAttempting to reconnect for 30 seconds\n"); fprintf(stderr, "Attempting to reconnect for 30 seconds\n");
for (tries=0;tries<30 * reconnects_per_second;tries++) { for (tries=0;tries<30 * reconnects_per_second;tries++) {
if (ast_tryconnect()) { if (ast_tryconnect()) {
fprintf(stderr, "Reconnect succeeded after %.3f seconds\n", 1.0 / reconnects_per_second * tries);
printf(term_quit()); printf(term_quit());
ast_register_verbose(console_verboser); WELCOME_MESSAGE;
ast_verbose( "Asterisk " ASTERISK_VERSION ", Copyright (C) 1999-2004 Digium.\n");
ast_verbose( "Written by Mark Spencer <markster@digium.com>\n");
ast_verbose( "=========================================================================\n");
break; break;
} else { } else {
usleep(1000000 / reconnects_per_second); usleep(1000000 / reconnects_per_second);
@@ -1626,9 +1628,7 @@ int main(int argc, char *argv[])
} }
printf(term_quit()); printf(term_quit());
ast_register_verbose(console_verboser); ast_register_verbose(console_verboser);
ast_verbose( "Asterisk " ASTERISK_VERSION ", Copyright (C) 1999-2004 Digium.\n"); WELCOME_MESSAGE;
ast_verbose( "Written by Mark Spencer <markster@digium.com>\n");
ast_verbose( "=========================================================================\n");
ast_remotecontrol(NULL); ast_remotecontrol(NULL);
quit_handler(0, 0, 0, 0); quit_handler(0, 0, 0, 0);
exit(0); exit(0);
@@ -1675,9 +1675,7 @@ int main(int argc, char *argv[])
ast_register_verbose(console_verboser); ast_register_verbose(console_verboser);
/* Print a welcome message if desired */ /* Print a welcome message if desired */
if (option_verbose || option_console) { if (option_verbose || option_console) {
ast_verbose( "Asterisk " ASTERISK_VERSION ", Copyright (C) 1999-2004 Digium.\n"); WELCOME_MESSAGE;
ast_verbose( "Written by Mark Spencer <markster@digium.com>\n");
ast_verbose( "=========================================================================\n");
} }
if (option_console && !option_verbose) if (option_console && !option_verbose)
ast_verbose("[ Booting..."); ast_verbose("[ Booting...");