Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ LIBGWDNS_TEST_TARGET = $(GWPROXY_DIR)/tests/dns.t
LIBGWDNS_TEST_CC_SOURCES = $(GWPROXY_DIR)/tests/dns.c
LIBGWDNS_TEST_OBJECTS = $(LIBGWDNS_TEST_CC_SOURCES:%.c=%.c.o)

ALL_TEST_TARGETS = $(LIBGWDNS_TEST_TARGET) $(LIBGWPSOCKS5_TEST_TARGET)
ALL_OBJECTS = $(GWPROXY_OBJECTS) $(LIBGWPSOCKS5_OBJECTS) $(LIBGWDNS_OBJECTS) $(LIBGWDNS_TEST_OBJECTS) $(LIBGWPSOCKS5_TEST_OBJECTS)
LIBGWDNS_CACHE_TEST_TARGET = $(GWPROXY_DIR)/tests/dns_cache.t
LIBGWDNS_CACHE_TEST_CC_SOURCES = $(GWPROXY_DIR)/tests/dns_cache.c
LIBGWDNS_CACHE_TEST_OBJECTS = $(LIBGWDNS_CACHE_TEST_CC_SOURCES:%.c=%.c.o)

ALL_TEST_TARGETS = $(LIBGWDNS_TEST_TARGET) $(LIBGWDNS_CACHE_TEST_TARGET) $(LIBGWPSOCKS5_TEST_TARGET)
ALL_OBJECTS = $(GWPROXY_OBJECTS) $(LIBGWPSOCKS5_OBJECTS) $(LIBGWDNS_OBJECTS) $(LIBGWDNS_TEST_OBJECTS) $(LIBGWDNS_CACHE_TEST_OBJECTS) $(LIBGWPSOCKS5_TEST_OBJECTS)
ALL_TARGETS = $(GWPROXY_TARGET) $(LIBGWPSOCKS5_TARGET) $(LIBGWDNS_TARGET) $(ALL_TEST_TARGETS)
ALL_DEPFILES = $(ALL_OBJECTS:.o=.o.d)

Expand All @@ -72,6 +76,9 @@ $(LIBGWDNS_TARGET): $(LIBGWDNS_OBJECTS)
$(LIBGWDNS_TEST_TARGET): $(LIBGWDNS_TEST_OBJECTS) $(LIBGWDNS_TARGET)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

$(LIBGWDNS_CACHE_TEST_TARGET): $(LIBGWDNS_CACHE_TEST_OBJECTS) $(LIBGWDNS_TARGET)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

%.c.o: %.c
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@

Expand All @@ -83,10 +90,12 @@ clean:
rm -f $(TO_BE_REMOVED)

IE=LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(shell pwd)
test: $(LIBGWDNS_TEST_TARGET) $(LIBGWPSOCKS5_TEST_TARGET)
test: $(LIBGWDNS_TEST_TARGET) $(LIBGWDNS_CACHE_TEST_TARGET) $(LIBGWPSOCKS5_TEST_TARGET)
@echo "Running tests...";
@echo "Testing libgwdns...";
@$(IE) ./$(LIBGWDNS_TEST_TARGET);
@echo "Testing libgwdns cache...";
@$(IE) ./$(LIBGWDNS_CACHE_TEST_TARGET);
@echo "Testing libgwpsocks5...";
@$(IE) ./$(LIBGWPSOCKS5_TEST_TARGET);
@echo "Tests completed successfully.";
Expand Down
2 changes: 1 addition & 1 deletion src/gwproxy/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static void process_queue_entry(struct gwp_dns_ctx *ctx)
* clone() for each entry if we can process them in the current
* thread.
*/
if ((ctx->nr_entries + 16) > ctx->nr_sleeping)
if (ctx->nr_entries > (ctx->nr_sleeping + 16))
process_queue_entry_batch(ctx);
else
process_queue_entry_single(ctx);
Expand Down
Loading
Loading