Commit 5c1dbfe6 authored by unknown's avatar unknown

64-bit portability fixes in network I/O

use $MAX_TABLES mysqltest variable to make join test portable
make test now works with the manager on IA64 Linux


client/mysqltest.c:
  added MAX_TABLES variable
libmysql/libmysql.c:
  portability fixes for 64-bit systems
mysql-test/mysql-test-run.sh:
  fixed bug - wrong values of -display in xterm in gdb mode
mysql-test/r/join.result:
  make test work on both 32-bit and 64-bit systems
mysql-test/t/join.test:
  make test work on both 32-bit and 64-bit systems
sql/mini_client.cc:
  64-bit portability fixes
sql/mini_client.h:
  64-bit portability fixes
sql/slave.cc:
  64-bit portability fixes
tools/mysqlmanager.c:
  64-bit portability fixes
parent a6c58676
...@@ -2158,12 +2158,15 @@ static void var_from_env(const char* name, const char* def_val) ...@@ -2158,12 +2158,15 @@ static void var_from_env(const char* name, const char* def_val)
static void init_var_hash() static void init_var_hash()
{ {
VAR* v;
if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0))) if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed"); die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306"); var_from_env("MASTER_MYPORT", "9306");
var_from_env("SLAVE_MYPORT", "9307"); var_from_env("SLAVE_MYPORT", "9307");
var_from_env("MYSQL_TEST_DIR", "/tmp"); var_from_env("MYSQL_TEST_DIR", "/tmp");
var_from_env("BIG_TEST", opt_big_test ? "1" : "0"); var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
v=var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "63",0);
hash_insert(&var_hash, (byte*)v);
} }
......
...@@ -905,7 +905,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, ...@@ -905,7 +905,8 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, static MYSQL_DATA *read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
uint fields) uint fields)
{ {
uint field,pkt_len; uint field;
ulong pkt_len;
ulong len; ulong len;
uchar *cp; uchar *cp;
char *to; char *to;
...@@ -991,7 +992,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths) ...@@ -991,7 +992,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
ulong pkt_len,len; ulong pkt_len,len;
uchar *pos,*prev_pos; uchar *pos,*prev_pos;
if ((pkt_len=(uint) net_safe_read(mysql)) == packet_error) if ((pkt_len=net_safe_read(mysql)) == packet_error)
return -1; return -1;
if (pkt_len == 1 && mysql->net.read_pos[0] == 254) if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
return 1; /* End of data */ return 1; /* End of data */
...@@ -1453,7 +1454,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -1453,7 +1454,7 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
my_socket sock; my_socket sock;
uint32 ip_addr; uint32 ip_addr;
struct sockaddr_in sock_addr; struct sockaddr_in sock_addr;
uint pkt_length; ulong pkt_length;
NET *net= &mysql->net; NET *net= &mysql->net;
#ifdef __WIN__ #ifdef __WIN__
HANDLE hPipe=INVALID_HANDLE_VALUE; HANDLE hPipe=INVALID_HANDLE_VALUE;
...@@ -2135,7 +2136,7 @@ int STDCALL mysql_read_query_result(MYSQL *mysql) ...@@ -2135,7 +2136,7 @@ int STDCALL mysql_read_query_result(MYSQL *mysql)
uchar *pos; uchar *pos;
ulong field_count; ulong field_count;
MYSQL_DATA *fields; MYSQL_DATA *fields;
uint length; ulong length;
DBUG_ENTER("mysql_read_query_result"); DBUG_ENTER("mysql_read_query_result");
/* read from the connection which we actually used, which /* read from the connection which we actually used, which
......
...@@ -674,8 +674,8 @@ start_master() ...@@ -674,8 +674,8 @@ start_master()
elif [ x$DO_GDB = x1 ] elif [ x$DO_GDB = x1 ]
then then
$ECHO "set args $master_args" > $GDB_MASTER_INIT $ECHO "set args $master_args" > $GDB_MASTER_INIT
manager_launch master $XTERM -display :0 -title "Master" -e gdb -x \ manager_launch master $XTERM -display $DISPLAY \
$GDB_MASTER_INIT $MYSQLD -title "Master" -e gdb -x $GDB_MASTER_INIT $MYSQLD
else else
manager_launch master $MYSQLD $master_args manager_launch master $MYSQLD $master_args
fi fi
......
...@@ -89,7 +89,7 @@ a ...@@ -89,7 +89,7 @@ a
1 1
2 2
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a); select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
Too many tables. MySQL can only use 31 tables in a join Too many tables. MySQL can only use $MAX_TABLES tables in a join
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int(11) NOT NULL, a int(11) NOT NULL,
......
# #
# This failed for lia Perminov # This failed for lia Perminov
# #
eval_result; # because MAX_TABLES is different on 64-bit system
drop table if exists t1,t2; drop table if exists t1,t2;
create table t1 (id int primary key); create table t1 (id int primary key);
create table t2 (id int); create table t2 (id int);
......
...@@ -351,11 +351,11 @@ static int mc_sock_connect(my_socket s, const struct sockaddr *name, ...@@ -351,11 +351,11 @@ static int mc_sock_connect(my_socket s, const struct sockaddr *name,
** or packet is an error message ** or packet is an error message
*****************************************************************************/ *****************************************************************************/
uint STDCALL ulong STDCALL
mc_net_safe_read(MYSQL *mysql) mc_net_safe_read(MYSQL *mysql)
{ {
NET *net= &mysql->net; NET *net= &mysql->net;
uint len=0; ulong len=0;
if (net->vio != 0) if (net->vio != 0)
len=my_net_read(net); len=my_net_read(net);
...@@ -514,7 +514,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user, ...@@ -514,7 +514,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
my_socket sock; my_socket sock;
ulong ip_addr; ulong ip_addr;
struct sockaddr_in sock_addr; struct sockaddr_in sock_addr;
uint pkt_length; ulong pkt_length;
NET *net= &mysql->net; NET *net= &mysql->net;
thr_alarm_t alarmed; thr_alarm_t alarmed;
ALARM alarm_buff; ALARM alarm_buff;
...@@ -921,8 +921,8 @@ void STDCALL mc_mysql_free_result(MYSQL_RES *result) ...@@ -921,8 +921,8 @@ void STDCALL mc_mysql_free_result(MYSQL_RES *result)
DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows")); DBUG_PRINT("warning",("Not all rows in set were read; Ignoring rows"));
for (;;) for (;;)
{ {
uint pkt_len; ulong pkt_len;
if ((pkt_len=(uint) mc_net_safe_read(result->handle)) == packet_error) if ((pkt_len=mc_net_safe_read(result->handle)) == packet_error)
break; break;
if (pkt_len == 1 && result->handle->net.read_pos[0] == 254) if (pkt_len == 1 && result->handle->net.read_pos[0] == 254)
break; /* End of data */ break; /* End of data */
...@@ -999,7 +999,7 @@ int STDCALL mc_mysql_read_query_result(MYSQL *mysql) ...@@ -999,7 +999,7 @@ int STDCALL mc_mysql_read_query_result(MYSQL *mysql)
uchar *pos; uchar *pos;
ulong field_count; ulong field_count;
MYSQL_DATA *fields; MYSQL_DATA *fields;
uint length; ulong length;
DBUG_ENTER("mc_mysql_read_query_result"); DBUG_ENTER("mc_mysql_read_query_result");
if ((length = mc_net_safe_read(mysql)) == packet_error) if ((length = mc_net_safe_read(mysql)) == packet_error)
...@@ -1174,7 +1174,8 @@ static my_ulonglong mc_net_field_length_ll(uchar **packet) ...@@ -1174,7 +1174,8 @@ static my_ulonglong mc_net_field_length_ll(uchar **packet)
static MYSQL_DATA *mc_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, static MYSQL_DATA *mc_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
uint fields) uint fields)
{ {
uint field,pkt_len; uint field;
ulong pkt_len;
ulong len; ulong len;
uchar *cp; uchar *cp;
char *to; char *to;
...@@ -1183,7 +1184,7 @@ static MYSQL_DATA *mc_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields, ...@@ -1183,7 +1184,7 @@ static MYSQL_DATA *mc_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
NET *net = &mysql->net; NET *net = &mysql->net;
DBUG_ENTER("mc_read_rows"); DBUG_ENTER("mc_read_rows");
if ((pkt_len=(uint) mc_net_safe_read(mysql)) == packet_error) if ((pkt_len=mc_net_safe_read(mysql)) == packet_error)
DBUG_RETURN(0); DBUG_RETURN(0);
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA), if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
MYF(MY_WME | MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
...@@ -1260,7 +1261,7 @@ static int mc_read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ...@@ -1260,7 +1261,7 @@ static int mc_read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row,
ulong pkt_len,len; ulong pkt_len,len;
uchar *pos,*prev_pos; uchar *pos,*prev_pos;
if ((pkt_len=(uint) mc_net_safe_read(mysql)) == packet_error) if ((pkt_len=mc_net_safe_read(mysql)) == packet_error)
return -1; return -1;
if (pkt_len == 1 && mysql->net.read_pos[0] == 254) if (pkt_len == 1 && mysql->net.read_pos[0] == 254)
return 1; /* End of data */ return 1; /* End of data */
......
...@@ -35,7 +35,7 @@ mc_mysql_init(MYSQL *mysql); ...@@ -35,7 +35,7 @@ mc_mysql_init(MYSQL *mysql);
void STDCALL void STDCALL
mc_mysql_debug(const char *debug); mc_mysql_debug(const char *debug);
uint STDCALL ulong STDCALL
mc_net_safe_read(MYSQL *mysql); mc_net_safe_read(MYSQL *mysql);
char * STDCALL mc_mysql_error(MYSQL *mysql); char * STDCALL mc_mysql_error(MYSQL *mysql);
......
...@@ -335,7 +335,7 @@ static int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) ...@@ -335,7 +335,7 @@ static int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
static int create_table_from_dump(THD* thd, NET* net, const char* db, static int create_table_from_dump(THD* thd, NET* net, const char* db,
const char* table_name) const char* table_name)
{ {
uint packet_len = my_net_read(net); // read create table statement ulong packet_len = my_net_read(net); // read create table statement
Vio* save_vio; Vio* save_vio;
HA_CHECK_OPT check_opt; HA_CHECK_OPT check_opt;
TABLE_LIST tables; TABLE_LIST tables;
...@@ -870,7 +870,7 @@ command"); ...@@ -870,7 +870,7 @@ command");
static uint read_event(MYSQL* mysql, MASTER_INFO *mi) static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
{ {
uint len = packet_error; ulong len = packet_error;
// for convinience lets think we start by // for convinience lets think we start by
// being in the interrupted state :-) // being in the interrupted state :-)
int read_errno = EINTR; int read_errno = EINTR;
...@@ -890,7 +890,7 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi) ...@@ -890,7 +890,7 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
} }
if (abort_loop || abort_slave) if (abort_loop || abort_slave)
return packet_error; return packet_error;
if (len == packet_error || (int) len < 1) if (len == packet_error || (long) len < 1)
{ {
sql_print_error("Error reading packet from server: %s (read_errno %d,\ sql_print_error("Error reading packet from server: %s (read_errno %d,\
server_errno=%d)", server_errno=%d)",
......
...@@ -291,9 +291,9 @@ static void die(const char* fmt,...); ...@@ -291,9 +291,9 @@ static void die(const char* fmt,...);
static void print_time(FILE* fp); static void print_time(FILE* fp);
static void clean_up(); static void clean_up();
static struct manager_cmd* lookup_cmd(char* s,int len); static struct manager_cmd* lookup_cmd(char* s,int len);
static void client_msg(NET* net,int err_code,const char* fmt,...); static int client_msg(NET* net,int err_code,const char* fmt,...);
static void client_msg_pre(NET* net,int err_code,const char* fmt,...); static int client_msg_pre(NET* net,int err_code,const char* fmt,...);
static void client_msg_raw(NET* net,int err_code,int pre,const char* fmt, static int client_msg_raw(NET* net,int err_code,int pre,const char* fmt,
va_list args); va_list args);
static int authenticate(struct manager_thd* thd); static int authenticate(struct manager_thd* thd);
static char* read_line(struct manager_thd* thd); /* returns pointer to end of static char* read_line(struct manager_thd* thd); /* returns pointer to end of
...@@ -307,6 +307,27 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end); ...@@ -307,6 +307,27 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end);
void print_stacktrace(); void print_stacktrace();
#endif #endif
static void log_msg(const char* fmt, int msg_type, va_list args);
/* No 'inline' here becasue functions with ... can't do that portable */
#define LOG_MSG_FUNC(type,TYPE) static void type \
(const char* fmt,...) { \
va_list args; \
va_start(args,fmt); \
log_msg(fmt,TYPE,args);\
}
LOG_MSG_FUNC(log_err,LOG_ERR)
LOG_MSG_FUNC(log_warn,LOG_WARN)
LOG_MSG_FUNC(log_info,LOG_INFO)
#ifndef DBUG_OFF
LOG_MSG_FUNC(log_debug,LOG_DEBUG)
#else
void log_debug(const char* __attribute__((unused)) fmt,...) {}
#endif
static void handle_segfault(int sig) static void handle_segfault(int sig)
{ {
if (in_segfault) if (in_segfault)
...@@ -369,11 +390,13 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end) ...@@ -369,11 +390,13 @@ static int exec_line(struct manager_thd* thd,char* buf,char* buf_end)
struct manager_cmd* cmd; struct manager_cmd* cmd;
for (;p<buf_end && !isspace(*p);p++) for (;p<buf_end && !isspace(*p);p++)
*p=tolower(*p); *p=tolower(*p);
log_info("Command '%s'", buf);
if (!(cmd=lookup_cmd(buf,(int)(p-buf)))) if (!(cmd=lookup_cmd(buf,(int)(p-buf))))
{ {
client_msg(&thd->net,MANAGER_CLIENT_ERR, if(client_msg(&thd->net,MANAGER_CLIENT_ERR,
"Unrecognized command, type help to see list of supported\ "Unrecognized command '%s', type help to see list of supported\
commands"); commands", buf))
thd->fatal=1;
return 1; return 1;
} }
for (;p<buf_end && isspace(*p);p++); for (;p<buf_end && isspace(*p);p++);
...@@ -1025,24 +1048,6 @@ static void log_msg(const char* fmt, int msg_type, va_list args) ...@@ -1025,24 +1048,6 @@ static void log_msg(const char* fmt, int msg_type, va_list args)
pthread_mutex_unlock(&lock_log); pthread_mutex_unlock(&lock_log);
} }
/* No 'inline' here becasue functions with ... can't do that portable */
#define LOG_MSG_FUNC(type,TYPE) static void type \
(const char* fmt,...) { \
va_list args; \
va_start(args,fmt); \
log_msg(fmt,TYPE,args);\
}
LOG_MSG_FUNC(log_err,LOG_ERR)
LOG_MSG_FUNC(log_warn,LOG_WARN)
LOG_MSG_FUNC(log_info,LOG_INFO)
#ifndef DBUG_OFF
LOG_MSG_FUNC(log_debug,LOG_DEBUG)
#else
void log_debug(const char* __attribute__((unused)) fmt,...) {}
#endif
static pthread_handler_decl(process_launcher_messages, static pthread_handler_decl(process_launcher_messages,
__attribute__((unused)) arg) __attribute__((unused)) arg)
{ {
...@@ -1121,7 +1126,7 @@ static pthread_handler_decl(process_connection,arg) ...@@ -1121,7 +1126,7 @@ static pthread_handler_decl(process_connection,arg)
return 0; /* Don't get cc warning */ return 0; /* Don't get cc warning */
} }
static void client_msg_raw(NET* net, int err_code, int pre, const char* fmt, static int client_msg_raw(NET* net, int err_code, int pre, const char* fmt,
va_list args) va_list args)
{ {
char buf[MAX_CLIENT_MSG_LEN],*p,*buf_end; char buf[MAX_CLIENT_MSG_LEN],*p,*buf_end;
...@@ -1136,29 +1141,36 @@ static void client_msg_raw(NET* net, int err_code, int pre, const char* fmt, ...@@ -1136,29 +1141,36 @@ static void client_msg_raw(NET* net, int err_code, int pre, const char* fmt,
p=buf_end - 2; p=buf_end - 2;
*p++='\r'; *p++='\r';
*p++='\n'; *p++='\n';
if (my_net_write(net,buf,(uint)(p-buf)) || net_flush(net)) if (my_net_write(net,buf,(uint)(p-buf)) || net_flush(net))
log_err("Failed writing to client: errno=%d",net->last_errno); {
p[-2]=0;
log_err("Failed writing '%s' to client: errno=%d",buf,errno);
net_end(net);
return 1;
}
return 0;
} }
static void client_msg(NET* net, int err_code, const char* fmt, ...) static int client_msg(NET* net, int err_code, const char* fmt, ...)
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
client_msg_raw(net,err_code,0,fmt,args); return client_msg_raw(net,err_code,0,fmt,args);
} }
static void client_msg_pre(NET* net, int err_code, const char* fmt, ...) static int client_msg_pre(NET* net, int err_code, const char* fmt, ...)
{ {
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
client_msg_raw(net,err_code,1,fmt,args); return client_msg_raw(net,err_code,1,fmt,args);
} }
static char* read_line(struct manager_thd* thd) static char* read_line(struct manager_thd* thd)
{ {
uint len; int len;
char* p, *buf_end; char* p, *buf_end;
if ((len=my_net_read(&thd->net)) == packet_error) if ((len=my_net_read(&thd->net)) == (int)packet_error || !len)
{ {
log_err("Error reading command from client (Error: %d)", log_err("Error reading command from client (Error: %d)",
errno); errno);
...@@ -1212,6 +1224,12 @@ struct manager_thd* manager_thd_new(Vio* vio) ...@@ -1212,6 +1224,12 @@ struct manager_thd* manager_thd_new(Vio* vio)
static void manager_thd_free(struct manager_thd* thd) static void manager_thd_free(struct manager_thd* thd)
{ {
NET* net=&thd->net;
if (net->vio)
{
vio_delete(net->vio);
net->vio=0;
}
net_end(&thd->net); net_end(&thd->net);
} }
...@@ -1379,15 +1397,18 @@ static int run_server_loop() ...@@ -1379,15 +1397,18 @@ static int run_server_loop()
vio_close(vio); vio_close(vio);
continue; continue;
} }
if (authenticate(thd)) if (authenticate(thd))
{ {
client_msg(&thd->net,MANAGER_ACCESS, "Access denied"); client_msg(&thd->net,MANAGER_ACCESS, "Access denied");
manager_thd_free(thd); manager_thd_free(thd);
log_info("Client failed to authenticate");
continue; continue;
} }
if (shutdown_requested) if (shutdown_requested)
{
manager_thd_free(thd);
break; break;
}
if (one_thread) if (one_thread)
{ {
process_connection((void*)thd); process_connection((void*)thd);
......
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