diff --git a/auto-static.c b/auto-static.c index fe281cb..cd636a9 100644 --- a/auto-static.c +++ b/auto-static.c @@ -295,12 +295,12 @@ static void local_next_token (void) { static struct paramed_type *fvars[MAX_FVARS]; static int fvars_pos; -void add_var_to_be_freed (struct paramed_type *P) { +static void add_var_to_be_freed (struct paramed_type *P) { assert (fvars_pos < MAX_FVARS); fvars[fvars_pos ++] = P; } -void free_vars_to_be_freed (void) { +static void free_vars_to_be_freed (void) { int i; for (i = 0; i < fvars_pos; i++) { tgl_paramed_type_free (fvars[i]); @@ -314,8 +314,9 @@ int tglf_extf_autocomplete (const char *text, int text_len, int index, char **R, buffer_end = data + data_len; autocomplete_mode = 0; local_next_token (); - autocomplete_function_any (); + struct paramed_type *P = autocomplete_function_any (); free_vars_to_be_freed (); + if (P) { tgl_paramed_type_free (P); } } if (autocomplete_mode == 0) { return -1; } int len = strlen (text); diff --git a/binlog.c b/binlog.c index 2577f6d..7e7204d 100644 --- a/binlog.c +++ b/binlog.c @@ -1260,12 +1260,12 @@ static void create_new_binlog (void) { packet_ptr = s; out_int (CODE_binlog_start); out_int (CODE_binlog_dc_option); - out_int (1); + out_int (tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC); out_string (""); out_string (tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER); out_int (443); out_int (CODE_binlog_default_dc); - out_int (1); + out_int (tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC); int fd = open (get_binlog_file_name (), O_WRONLY | O_EXCL | O_CREAT, 0600); if (fd < 0) { diff --git a/loop.c b/loop.c index 5faf622..9052261 100644 --- a/loop.c +++ b/loop.c @@ -485,8 +485,10 @@ void read_dc (int auth_file_fd, int id, unsigned ver) { void empty_auth_file (void) { char *ip = tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER; - bl_do_dc_option (1, 3, "DC1", strlen (ip), ip, 443); - bl_do_set_working_dc (1); + static char s[20]; + sprintf (s, "DC%d", tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC); + bl_do_dc_option (tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC, strlen (s), s, strlen (ip), ip, 443); + bl_do_set_working_dc (tgl_state.test_mode ? TG_SERVER_TEST_DC : TG_SERVER_DC); } int need_dc_list_update; diff --git a/tgl.h b/tgl.h index 7a59cff..8320bc5 100644 --- a/tgl.h +++ b/tgl.h @@ -24,8 +24,10 @@ #include #define TGL_MAX_DC_NUM 100 -#define TG_SERVER "173.240.5.1" -#define TG_SERVER_TEST "173.240.5.253" +#define TG_SERVER "149.154.167.50" +#define TG_SERVER_TEST "149.154.167.40" +#define TG_SERVER_DC 2 +#define TG_SERVER_TEST_DC 2 // JUST RANDOM STRING #define TGL_BUILD "2012"