Update code
This commit is contained in:
@@ -1228,6 +1228,9 @@ static int _dns_decode_opt_ecs(struct dns_context *context, struct dns_opt_ecs *
|
||||
memcpy(ecs->addr, context->ptr, len);
|
||||
context->ptr += len;
|
||||
|
||||
tlog(TLOG_DEBUG, "ECS: family:%d, source_prefix:%d, scope_prefix:%d, len:%d", ecs->family, ecs->source_prefix, ecs->scope_prefix, len);
|
||||
tlog(TLOG_DEBUG, "%d.%d.%d.%d", ecs->addr[0], ecs->addr[1], ecs->addr[2], ecs->addr[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1283,9 +1286,11 @@ static int _dns_decode_opt(struct dns_context *context, dns_rr_type type, unsign
|
||||
}
|
||||
ever = ever;
|
||||
|
||||
tlog(TLOG_DEBUG, "decode opt.");
|
||||
while (context->ptr - start < rr_len) {
|
||||
opt_code = dns_read_short(&context->ptr);
|
||||
opt_len = dns_read_short(&context->ptr);
|
||||
tlog(TLOG_DEBUG, "opt type %d", opt_code);
|
||||
switch (opt_code) {
|
||||
case DNS_OPT_T_ECS: {
|
||||
struct dns_opt_ecs ecs;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* ttinylog
|
||||
* Copyright (C) 2018 Ruilin Peng (Nick) <pymumu@gmail.com>
|
||||
* https://github.com/pymumu/tinylog
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "tlog.h"
|
||||
@@ -591,6 +593,7 @@ static void _tlog_close_all_fd(void)
|
||||
char path_name[PATH_MAX];
|
||||
DIR *dir = NULL;
|
||||
struct dirent *ent;
|
||||
int dir_fd = -1;
|
||||
|
||||
snprintf(path_name, sizeof(path_name), "/proc/self/fd/");
|
||||
dir = opendir(path_name);
|
||||
@@ -599,9 +602,11 @@ static void _tlog_close_all_fd(void)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
dir_fd = dirfd(dir);
|
||||
|
||||
while ((ent = readdir(dir)) != NULL) {
|
||||
int fd = atoi(ent->d_name);
|
||||
if (fd < 0 || dirfd(dir) == fd) {
|
||||
if (fd < 0 || dir_fd == fd) {
|
||||
continue;
|
||||
}
|
||||
switch (fd) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* tinylog
|
||||
* Copyright (C) 2018 Ruilin Peng (Nick) <pymumu@gmail.com>
|
||||
* https://github.com/pymumu/tinylog
|
||||
*/
|
||||
|
||||
#ifndef TLOG_H
|
||||
|
||||
Reference in New Issue
Block a user