Commit 84905f07 authored by Vysheng's avatar Vysheng

Changed default DC. Fixed memory leak

parent bb21fc5e
...@@ -295,12 +295,12 @@ static void local_next_token (void) { ...@@ -295,12 +295,12 @@ static void local_next_token (void) {
static struct paramed_type *fvars[MAX_FVARS]; static struct paramed_type *fvars[MAX_FVARS];
static int fvars_pos; 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); assert (fvars_pos < MAX_FVARS);
fvars[fvars_pos ++] = P; fvars[fvars_pos ++] = P;
} }
void free_vars_to_be_freed (void) { static void free_vars_to_be_freed (void) {
int i; int i;
for (i = 0; i < fvars_pos; i++) { for (i = 0; i < fvars_pos; i++) {
tgl_paramed_type_free (fvars[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, ...@@ -314,8 +314,9 @@ int tglf_extf_autocomplete (const char *text, int text_len, int index, char **R,
buffer_end = data + data_len; buffer_end = data + data_len;
autocomplete_mode = 0; autocomplete_mode = 0;
local_next_token (); local_next_token ();
autocomplete_function_any (); struct paramed_type *P = autocomplete_function_any ();
free_vars_to_be_freed (); free_vars_to_be_freed ();
if (P) { tgl_paramed_type_free (P); }
} }
if (autocomplete_mode == 0) { return -1; } if (autocomplete_mode == 0) { return -1; }
int len = strlen (text); int len = strlen (text);
......
...@@ -1260,12 +1260,12 @@ static void create_new_binlog (void) { ...@@ -1260,12 +1260,12 @@ static void create_new_binlog (void) {
packet_ptr = s; packet_ptr = s;
out_int (CODE_binlog_start); out_int (CODE_binlog_start);
out_int (CODE_binlog_dc_option); 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 ("");
out_string (tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER); out_string (tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER);
out_int (443); out_int (443);
out_int (CODE_binlog_default_dc); 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); int fd = open (get_binlog_file_name (), O_WRONLY | O_EXCL | O_CREAT, 0600);
if (fd < 0) { if (fd < 0) {
......
...@@ -485,8 +485,10 @@ void read_dc (int auth_file_fd, int id, unsigned ver) { ...@@ -485,8 +485,10 @@ void read_dc (int auth_file_fd, int id, unsigned ver) {
void empty_auth_file (void) { void empty_auth_file (void) {
char *ip = tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER; char *ip = tgl_state.test_mode ? TG_SERVER_TEST : TG_SERVER;
bl_do_dc_option (1, 3, "DC1", strlen (ip), ip, 443); static char s[20];
bl_do_set_working_dc (1); 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; int need_dc_list_update;
......
...@@ -24,8 +24,10 @@ ...@@ -24,8 +24,10 @@
#include <string.h> #include <string.h>
#define TGL_MAX_DC_NUM 100 #define TGL_MAX_DC_NUM 100
#define TG_SERVER "173.240.5.1" #define TG_SERVER "149.154.167.50"
#define TG_SERVER_TEST "173.240.5.253" #define TG_SERVER_TEST "149.154.167.40"
#define TG_SERVER_DC 2
#define TG_SERVER_TEST_DC 2
// JUST RANDOM STRING // JUST RANDOM STRING
#define TGL_BUILD "2012" #define TGL_BUILD "2012"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment