修复log记录错误(第一个节点无法落盘),更新http解析为现成库实现,优化退出逻辑。
This commit is contained in:
@ -87,19 +87,20 @@ int cleanup(log_manager *self)
|
||||
loc = self->log;
|
||||
self->log = NULL;
|
||||
self->count = 0;//摘取log链
|
||||
|
||||
sem_post(&self->log_sem);
|
||||
//释放信号量
|
||||
int fd = open("log.txt",O_CREAT | O_WRONLY | O_APPEND, 0777);
|
||||
while(loc->next !=NULL)
|
||||
{
|
||||
tobeclean = loc;
|
||||
loc = loc->next;
|
||||
int fd = open("log.txt",O_CREAT | O_WRONLY | O_APPEND, 0777);
|
||||
if(fd == -1)
|
||||
perror("file:");
|
||||
write(fd,loc->log,strlen(loc->log));
|
||||
close(fd);
|
||||
write(fd,tobeclean->log,strlen(tobeclean->log));
|
||||
free(tobeclean);
|
||||
}
|
||||
close(fd);
|
||||
free(loc);
|
||||
}
|
||||
|
||||
|
||||
@ -28,10 +28,10 @@ int quit_server(netm *self)
|
||||
self->http_fd =-1;
|
||||
}
|
||||
//关闭socket监听
|
||||
if(self->fifo_fd[0] != -1)
|
||||
if(self->fifo_fd[1] != -1)
|
||||
{
|
||||
close(self->fifo_fd[0]);
|
||||
self->fifo_fd[0] = -1;
|
||||
close(self->fifo_fd[1]);
|
||||
self->fifo_fd[1] = -1;
|
||||
}
|
||||
//关闭管道监听
|
||||
|
||||
|
||||
Reference in New Issue
Block a user