* Pavel Rappo: >> On 4 Sep 2019, at 18:38, Florian Weimer <fwei...@redhat.com> wrote: >> >> <snip> >> >> Maybe I'm mistaken, but I think this: >> >> 692 Tcp(InetAddress server, int port, int timeout) throws IOException { >> 693 sock = new Socket(server, port); >> 694 sock.setTcpNoDelay(true); >> 695 out = new java.io.BufferedOutputStream(sock.getOutputStream()); >> 696 in = new java.io.BufferedInputStream(sock.getInputStream()); >> 697 timeoutLeft = timeout; >> 698 } >> >> creates the TCP socket and connects it. This is a potentially blocking >> operation as well. > > You are right, it definitely is a blocking operation. I missed it. I was > focused on > > 712 sock.setSoTimeout(timeoutLeft); > > So I'd suggest we use explicit connect with timeout > > java.net.Socket#connect(java.net.SocketAddress, int) > > Are you okay with that?
Sure. You should use a larger timeout than the initial UDP timeout, though. Can you compute the maximum amount of time the UDP code would wait for reply and use that? Or is that the timeoutLeft value? Thanks, Florian