1
0
mirror of https://github.com/fumiama/simple-dict.git synced 2026-06-09 12:40:31 +08:00

fix: 错误交互

This commit is contained in:
源文雨
2022-05-06 20:13:19 +08:00
parent 8536557d27
commit 013a2e323f
2 changed files with 6 additions and 2 deletions

View File

@@ -330,6 +330,7 @@ ERR_INSERT_ITEM:
}
static int s3_set_data(thread_timer_t *timer) {
if(!setdicts[timer->index].data[0]) return send_data(timer->accept_fd, timer->index, ACKERRO, "erro", 4);
FILE *fp = open_ex_dict();
if(fp == NULL) return send_data(timer->accept_fd, timer->index, ACKERRO, "erro", 4);
@@ -378,6 +379,8 @@ static int s3_set_data(thread_timer_t *timer) {
r = send_data(timer->accept_fd, timer->index, ACKSUCC, "succ", 4);
}
setdicts[timer->index].data[0] = 0;
pthread_cleanup_pop(1);
return r;
}
@@ -523,6 +526,7 @@ static void cleanup_thread(thread_timer_t* timer) {
pthread_sigmask(SIG_BLOCK, &mask, NULL);
puts("Start cleaning");
timer->thread = 0;
setdicts[timer->index].data[0] = 0;
if(timer->accept_fd) {
close(timer->accept_fd);
timer->accept_fd = 0;