The purpose of this feature is to implement an optional HTTP client side timeout using HttpURLConnection.setReadTimeout(int timeout) because the API Server doesn't provide any timeout mechanism and when java-ipfs-http-client does IPFS.cat(multihash) but the hash cannot be found on the IPFS network, the call hangs forever (or until found).
This is usually quite risky and bad practice for a client to block threads like that.
So the idea is to configure a timeout (in ms) to prevent this:
timeout is set by default to 0 (infinite timeout) to avoid compatibility issues
timeout can be configured like this:
IPFS ipfs = new IPFS(new MultiAddress("/ip4/127.0.0.1/tcp/5001")).timeout(1000)
The purpose of this feature is to implement an optional HTTP client side timeout using
HttpURLConnection.setReadTimeout(int timeout)
because the API Server doesn't provide any timeout mechanism and when java-ipfs-http-client doesIPFS.cat(multihash)
but the hash cannot be found on the IPFS network, the call hangs forever (or until found). This is usually quite risky and bad practice for a client to block threads like that.So the idea is to configure a timeout (in ms) to prevent this:
timeout
is set by default to 0 (infinite timeout) to avoid compatibility issuestimeout
can be configured like this: