Opened 5 weeks ago

Closed 4 weeks ago

#2440 closed enhancement (fixed)

NTCP write should be in a loop

Reported by: zab Owned by: zzz
Priority: minor Milestone: 0.9.39
Component: router/transport Version: 0.9.38
Keywords: ntcp nio Cc:
Parent Tickets:

Description

This is symmetric to #2243 except for writing. There is no guarantee that a single write call will write the entire buffer, so the write should be in a loop until it returns 0 or there is nothing more to write.

One possible way of doing this is:

#
# old_revision [5175d0f5f52c62ecc0e2e76c53e445d47181ec9e]
#
# patch "router/java/src/net/i2p/router/transport/ntcp/EventPumper.java"
#  from [f284aa0bf8e6a8fe2b465e349d98e677a5939021]
#    to [94a79661753d0228e6ec34d8cf909ca6f71c876b]
#
============================================================
--- router/java/src/net/i2p/router/transport/ntcp/EventPumper.java      f284aa0bf8e6a8fe2b465e349d98e677a5939021
+++ router/java/src/net/i2p/router/transport/ntcp/EventPumper.java      94a79661753d0228e6ec34d8cf909ca6f71c876b
@@ -753,7 +749,7 @@ class EventPumper implements Runnable {
                     } else if (buf.remaining() > 0) {
                         // stay interested
                         //key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
-                        break;
+                        continue;
                     } else {
                         con.removeWriteBuf(buf);
                         //if (buffer time is too much, add OP_WRITe to the interest ops and break?)

Subtickets

Change History (2)

comment:1 Changed 5 weeks ago by zzz

  • Milestone changed from undecided to 0.9.39

agreed

comment:2 Changed 4 weeks ago by zzz

  • Resolution set to fixed
  • Status changed from new to closed

In 9c206a80263cb001f5edf53dbb383b3d48aa22b3 to be 0.9.39-10

Note: See TracTickets for help on using tickets.