diff --git a/timer/lst_timer.cpp b/timer/lst_timer.cpp index 7efba9bd..578c9a5b 100644 --- a/timer/lst_timer.cpp +++ b/timer/lst_timer.cpp @@ -71,6 +71,7 @@ void sort_timer_lst::del_timer(util_timer *timer) if ((timer == head) && (timer == tail)) { delete timer; + timer = nullptr; head = NULL; tail = NULL; return; @@ -80,6 +81,7 @@ void sort_timer_lst::del_timer(util_timer *timer) head = head->next; head->prev = NULL; delete timer; + timer = nullptr; return; } if (timer == tail) @@ -87,11 +89,13 @@ void sort_timer_lst::del_timer(util_timer *timer) tail = tail->prev; tail->next = NULL; delete timer; + timer = nullptr; return; } timer->prev->next = timer->next; timer->next->prev = timer->prev; delete timer; + timer = nullptr; } void sort_timer_lst::tick() { diff --git a/webserver.cpp b/webserver.cpp index a9dfae0b..0d7e410a 100644 --- a/webserver.cpp +++ b/webserver.cpp @@ -197,7 +197,7 @@ void WebServer::deal_timer(util_timer *timer, int sockfd) LOG_INFO("close fd %d", users_timer[sockfd].sockfd); } -bool WebServer::dealclinetdata() +bool WebServer::dealclientdata() { struct sockaddr_in client_address; socklen_t client_addrlength = sizeof(client_address); @@ -395,7 +395,7 @@ void WebServer::eventLoop() //处理新到的客户连接 if (sockfd == m_listenfd) { - bool flag = dealclinetdata(); + bool flag = dealclientdata(); if (false == flag) continue; } diff --git a/webserver.h b/webserver.h index 7381a13e..12e2be7d 100644 --- a/webserver.h +++ b/webserver.h @@ -38,7 +38,7 @@ class WebServer void timer(int connfd, struct sockaddr_in client_address); void adjust_timer(util_timer *timer); void deal_timer(util_timer *timer, int sockfd); - bool dealclinetdata(); + bool dealclientdata(); bool dealwithsignal(bool& timeout, bool& stop_server); void dealwithread(int sockfd); void dealwithwrite(int sockfd);