修复端口绑定取消异常

This commit is contained in:
2026-01-29 14:03:43 +08:00
parent 3673b10942
commit 674f611d07
4 changed files with 30 additions and 8 deletions

View File

@ -217,6 +217,7 @@ int shutdown_pool(netm *self)
self->pool[i].status = -1;
close(self->pool[i].fifo_fd[1]);
}
self->statue = ALL_STOP;
return 1;
}
@ -239,6 +240,7 @@ int server_run(int port,int fifo_fd,netm *self)
epoll_ctl(epfd, EPOLL_CTL_ADD, self->http_fd, &ev);
struct epoll_event events[10];
self->epoll_fd = epfd;
self->statue = SERVER_ON;
for(;;)
{
/*工作循环-----------------------------*/
@ -306,6 +308,7 @@ void *run_network(void *self_d)
{
netm *self = (netm*)self_d;
self->start_pool(self);
self->statue = POOL_ON;
server_run(self->port,self->fifo_fd[0],self);
self->shutdown_pool(self);
}
@ -324,5 +327,6 @@ int init_networkmanager(netm *self,int *fifo,log_manager *logmanager,int port)
//初始化参数
self->logmanager = logmanager;
self->err_indictor = (indiector*)malloc(sizeof(indiector));
self->statue = ALL_STOP;
return 0;
}

View File

@ -1,6 +1,9 @@
#ifndef NETWORK
#define NETWORK
#define POOL_ON 1
#define SERVER_ON 2
#define ALL_STOP 0
#include <pthread.h>
#include "tools/log/log.h"
@ -36,6 +39,7 @@ typedef struct network_manager//网络管理器
int port;
int epoll_fd;
int http_fd;
int statue;
}netm;
typedef struct rebot_message