Jens-G commented on PR #3836:
URL: https://github.com/apache/thrift/pull/3836#issuecomment-5616331054

   ### Code review
   
   Found 1 issue:
   
   1. On Android, `listen()` now always throws `TTransportException(NOT_OPEN)` 
for non-Unix-domain sockets. With the `#ifdef ANDROID` branch removed, both the 
first resolve and the fallback pass `AI_V4MAPPED`, and bionic's `getaddrinfo()` 
rejects any flag outside `AI_MASK` (which does not include `AI_V4MAPPED`) with 
`EAI_BADFLAGS` before it looks at `ai_family` 
([getaddrinfo.c](https://github.com/aosp-mirror/platform_bionic/blob/731631f300090436d7f5df80d50b6275c8c60a93/libc/dns/net/getaddrinfo.c#L621-L624),
 
[netdb.h](https://github.com/aosp-mirror/platform_bionic/blob/731631f300090436d7f5df80d50b6275c8c60a93/libc/include/netdb.h#L163-L171)).
 So the commit message's "AI_V4MAPPED is ignored for AF_UNSPEC queries" does 
not hold on Android; this is the case ab72ebe564f890f5e37a9a7f892dc590d3d98834 
(#2406) worked around. `TSocket::open()` never passes `AI_V4MAPPED`, so 
resolving with exactly its flags (`AI_PASSIVE | AI_ADDRCONFIG`, then 
`AI_PASSIVE`) would avoid this. (bug due to `AI_PASS
 IVE | AI_V4MAPPED` in both resolve calls in `TServerSocket.cpp` and 
`TNonblockingServerSocket.cpp`)
   
   
https://github.com/apache/thrift/blob/00132b117dab6034841e75338e3155017aa06c14/lib/cpp/src/thrift/transport/TServerSocket.cpp#L456-L462
   
   
https://github.com/apache/thrift/blob/00132b117dab6034841e75338e3155017aa06c14/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp#L384-L390
   
   🤖 Generated with [Claude Code](https://claude.ai/code)
   
   <sub>- If this code review was useful, please react with 👍. Otherwise, react 
with 👎.</sub>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to