Only create ConnectTimeoutException if really needed (#10596)
Motivation: Creating exceptions is expensive so we should only do so if really needed. This is basically a port of #10595 for io_uring. Modifications: Only create the ConnectTimeoutException if we really need it. Result: Less overhead
This commit is contained in:
parent
0751becf03
commit
8ca81a2563
@ -674,9 +674,9 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha
|
||||
@Override
|
||||
public void run() {
|
||||
ChannelPromise connectPromise = AbstractIOUringChannel.this.connectPromise;
|
||||
ConnectTimeoutException cause =
|
||||
new ConnectTimeoutException("connection timed out: " + remoteAddress);
|
||||
if (connectPromise != null && connectPromise.tryFailure(cause)) {
|
||||
if (connectPromise != null && !connectPromise.isDone() &&
|
||||
connectPromise.tryFailure(new ConnectTimeoutException(
|
||||
"connection timed out: " + remoteAddress))) {
|
||||
close(voidPromise());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user