resolv: speed up the termination of loop thread in testing DNS and TLS servers
Use eventfd as a signal to notify the loop thread to terminate. The loop thread can be terminated right after their stopServer() is called. Also some minor changes: [1] Use unique_fd for sockets to avoid fd leakage. [2] Use ScopedAddrinfo in DnsTlsFrontend to prevent memory unfreed if getaddrinfo() fails. [3] Remove the unnecessary call stopServer() in resolver_test since it is automatically called in the their destructor. [4] Timeout value in the loop thread polling is set as -1 by default. Before this change: resolv_integration_test takes 145283 ms After this change: resolv_integration_test takes 125249 ms Bug: 130686826 Test: runtest and netd_benchmark passed Merged-In: I2810743d17f858a273157267495274195f04dcbc Merged-In: Ieb729e899506caad50a8c613c4b9e75209229135 Change-Id: I97c44ff87c4adfa6242bbd3aa0970474004c16f4 (cherry picked from commit a2b8cb03)
Loading
Please register or sign in to comment