Skip to content

Commit

Permalink
8280113: (dc) DatagramSocket.receive does not always throw when the c…
Browse files Browse the repository at this point in the history
…hannel is closed

Reviewed-by: mbaesken
Backport-of: b6ecca126846f9c53d554ff061cfe9b7b20a4d12
  • Loading branch information
GoeLin committed May 10, 2024
1 parent 97cc177 commit 4504b16
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -547,7 +547,7 @@ public SocketAddress receive(ByteBuffer dst) throws IOException {
n = receive(dst, connected);
}
}
if (n >= 0) {
if (n > 0 || (n == 0 && isOpen())) {
// sender address is in socket address buffer
sender = sourceSocketAddress();
}
Expand Down Expand Up @@ -668,7 +668,7 @@ private SocketAddress trustedBlockingReceive(ByteBuffer dst)
park(Net.POLLIN);
n = receive(dst, connected);
}
if (n >= 0) {
if (n > 0 || (n == 0 && isOpen())) {
// sender address is in socket address buffer
sender = sourceSocketAddress();
}
Expand Down Expand Up @@ -705,7 +705,7 @@ private SocketAddress trustedBlockingReceive(ByteBuffer dst, long nanos)
park(Net.POLLIN, remainingNanos);
n = receive(dst, connected);
}
if (n >= 0) {
if (n > 0 || (n == 0 && isOpen())) {
// sender address is in socket address buffer
sender = sourceSocketAddress();
}
Expand Down

1 comment on commit 4504b16

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.