This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch 2.0.X
in repository https://gitbox.apache.org/repos/asf/mina.git
The following commit(s) were added to refs/heads/2.0.X by this push:
new 3803c61 Replaced tabs with spaces, minor refactoring
3803c61 is described below
commit 3803c61b7b9921b358284c793cd3dcb6d5510983
Author: emmanuel lecharny <[email protected]>
AuthorDate: Tue Feb 8 00:21:28 2022 +0100
Replaced tabs with spaces, minor refactoring
---
.../transport/socket/nio/NioDatagramAcceptor.java | 60 +++++++++++-----------
1 file changed, 31 insertions(+), 29 deletions(-)
diff --git
a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
index 2db6a0c..0279a9e 100644
---
a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
+++
b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java
@@ -258,34 +258,34 @@ public final class NioDatagramAcceptor extends
AbstractIoAcceptor implements Dat
}
private void processReadySessions(Set<SelectionKey> handles) {
- final Iterator<SelectionKey> iterator = handles.iterator();
-
- while (iterator.hasNext()) {
- try {
- final SelectionKey key = iterator.next();
- final DatagramChannel handle = (DatagramChannel) key.channel();
-
- if (key.isValid()) {
- if (key.isReadable()) {
- readHandle(handle);
- }
-
- if (key.isWritable()) {
- for (IoSession session : getManagedSessions().values())
{
- final NioSession x = (NioSession) session;
- if (x.getChannel() == handle) {
- scheduleFlush(x);
- }
- }
- }
- }
-
- } catch (Exception e) {
- ExceptionMonitor.getInstance().exceptionCaught(e);
- } finally {
- iterator.remove();
- }
- }
+ Iterator<SelectionKey> iterator = handles.iterator();
+
+ while (iterator.hasNext()) {
+ try {
+ SelectionKey key = iterator.next();
+ DatagramChannel handle = (DatagramChannel) key.channel();
+
+ if (key.isValid()) {
+ if (key.isReadable()) {
+ readHandle(handle);
+ }
+
+ if (key.isWritable()) {
+ for (IoSession session :
getManagedSessions().values()) {
+ NioSession nioSession = (NioSession) session;
+
+ if (nioSession.getChannel() == handle) {
+ scheduleFlush(nioSession);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ ExceptionMonitor.getInstance().exceptionCaught(e);
+ } finally {
+ iterator.remove();
+ }
+ }
}
private boolean scheduleFlush(NioSession session) {
@@ -897,8 +897,10 @@ public final class NioDatagramAcceptor extends
AbstractIoAcceptor implements Dat
// Kernel buffer is full or wrote too much
setInterestedInWrite(session, true);
- session.getWriteRequestQueue().offer(session,
writeRequest);
+ writeRequestQueue.offer(session, writeRequest);
scheduleFlush(session);
+
+ break;
} else {
setInterestedInWrite(session, false);