diff --git a/qtfs/qtfs_common/conn.c b/qtfs/qtfs_common/conn.c index c34f9329b1c73ef5fe8b8b3c4615949bd16db90c..bbf7b42667b5082bce9a6ab5a7e150de0cb10704 100644 --- a/qtfs/qtfs_common/conn.c +++ b/qtfs/qtfs_common/conn.c @@ -527,7 +527,13 @@ static int qtfs_sm_connecting(struct qtfs_conn_var_s *pvar) qtfs_info("qtfs sm connecting connect to a new connection."); break; } + if (signal_pending(current)) { + qtfs_err("qtfs recv signal and break."); + break; + } +#ifdef QTFS_CLIENT msleep(100); +#endif } return ret; @@ -926,7 +932,11 @@ void qtfs_conn_put_param(struct qtfs_conn_var_s *pvar) return; } pvar->conn_ops->conn_msg_clear(pvar); - list_move_tail(&pvar->lst, &g_vld_lst); + if (pvar->state == QTCONN_ACTIVE) { + list_move_tail(&pvar->lst, &g_vld_lst); + } else { + list_add(&pvar->lst, &g_vld_lst); + } mutex_unlock(&g_param_mutex); } diff --git a/qtfs/qtfs_common/socket.c b/qtfs/qtfs_common/socket.c index 28d4d1bc26f93a421a608bb16bda3ca57cf9da2c..f247be09037527618ceddd1520bb590500e4e19b 100644 --- a/qtfs/qtfs_common/socket.c +++ b/qtfs/qtfs_common/socket.c @@ -170,7 +170,7 @@ static int qtfs_conn_sock_server_accept(void *connvar, qtfs_conn_type_e type) mutex_unlock(&qtfs_server_main_sock[type].lock); return -EINVAL; } - ret = kernel_accept(sock, &sockvar->client_sock, SOCK_NONBLOCK); + ret = kernel_accept(sock, &sockvar->client_sock, 0); if (ret < 0) { mutex_unlock(&qtfs_server_main_sock[type].lock); return ret; @@ -181,7 +181,7 @@ static int qtfs_conn_sock_server_accept(void *connvar, qtfs_conn_type_e type) sock_set_keepalive(sock->sk); #endif - qtfs_info("qtfs accept a client connection.\n"); + qtfs_info("qtfs accept a client connection, state:%d, ret:%d.\n", inet_sk_state_load(sockvar->client_sock->sk), ret); qtfs_sock_recvtimeo_set(sockvar->client_sock, QTFS_SOCK_RCVTIMEO, 0); mutex_unlock(&qtfs_server_main_sock[type].lock); return 0; @@ -245,7 +245,8 @@ static int qtfs_conn_sock_init(void *connvar, qtfs_conn_type_e type) goto err_end; } - qtfs_info("qtfs socket init sock OK!"); + qtfs_info("qtfs socket init sock OK, type:%d!", type); + qtfs_sock_recvtimeo_set(sock, 0, 100000); qtfs_server_main_sock[type].sock = sock; mutex_unlock(&qtfs_server_main_sock[type].lock); return 0;