修复端口绑定取消异常
This commit is contained in:
@ -15,28 +15,32 @@ int quit_server(netm *self)
|
||||
{
|
||||
if(self ==NULL)
|
||||
return -1;
|
||||
|
||||
//关闭epoll监听
|
||||
if(self->epoll_fd != -1)
|
||||
{
|
||||
epoll_ctl(self->epoll_fd,EPOLL_CTL_DEL,self->http_fd,NULL);
|
||||
epoll_ctl(self->epoll_fd,EPOLL_CTL_DEL,self->fifo_fd[0],NULL);
|
||||
self->epoll_fd = -1;
|
||||
}
|
||||
//关闭epoll监听
|
||||
//关闭socket监听
|
||||
if(self->http_fd != -1)
|
||||
{
|
||||
shutdown(self->http_fd, SHUT_RDWR);
|
||||
if(close(self->http_fd)==-1)
|
||||
return -1;
|
||||
perror("http");
|
||||
self->http_fd =-1;
|
||||
}
|
||||
//关闭socket监听
|
||||
//关闭管道监听
|
||||
if(self->fifo_fd[1] != -1)
|
||||
{
|
||||
if(close(self->fifo_fd[1])==-1)
|
||||
return -1;
|
||||
self->fifo_fd[1] = -1;
|
||||
}
|
||||
//关闭管道监听
|
||||
|
||||
free(self->err_indictor);
|
||||
self->statue = POOL_ON;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -49,7 +53,15 @@ void quit_all(int status,void *self_p)
|
||||
logs *netlog = (logs*)malloc(sizeof(logs));
|
||||
netlog->next = NULL;
|
||||
memcpy(netlog->log,"shuting down networkserver",27);
|
||||
quit_server(resouce->network);
|
||||
|
||||
if(resouce->network->statue == SERVER_ON)
|
||||
{
|
||||
quit_server(resouce->network);
|
||||
}
|
||||
if(resouce->network->statue == POOL_ON)
|
||||
{
|
||||
resouce->network->shutdown_pool(resouce->network);
|
||||
}
|
||||
resouce->loger->in_log(netlog,resouce->loger);
|
||||
free(resouce->network);
|
||||
//释放网络资源
|
||||
|
||||
Reference in New Issue
Block a user