修复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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user