Changeset acf5c31
- Timestamp:
- May 2, 2019 11:55:04 AM (2 years ago)
- Branches:
- master
- Children:
- 8cdeff7
- Parents:
- 20413f0
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
history.txt
r20413f0 racf5c31 1 2019-05-02 zzz 2 * NTCP: Rare EventPumper 100% CPU fix (ticket #2476) 3 1 4 2019-04-25 zzz 5 * Build: Drop unmaintained sample apparmor script (ticket #2319) 6 * i2ptunnel: Force connect delay and bulk profile for most 7 client tunnel types, and hide from UI 2 8 * Transport: Disable NTCP 1 by default 3 9 -
router/java/src/net/i2p/router/RouterVersion.java
r20413f0 racf5c31 19 19 public final static String ID = "Monotone"; 20 20 public final static String VERSION = CoreVersion.VERSION; 21 public final static long BUILD = 8;21 public final static long BUILD = 9; 22 22 23 23 /** for example "-test" */ 24 public final static String EXTRA = " ";24 public final static String EXTRA = "-rc"; 25 25 public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA; 26 26 public static void main(String args[]) { -
router/java/src/net/i2p/router/transport/ntcp/EventPumper.java
r20413f0 racf5c31 269 269 // this will cancel the key, and it will then be removed from the keyset 270 270 con.close(); 271 key.cancel(); 271 272 failsafeInvalid++; 272 273 continue; … … 299 300 // we haven't sent or received anything in a really long time, so lets just close 'er up 300 301 con.sendTerminationAndClose(); 302 key.cancel(); 301 303 if (_log.shouldInfo()) 302 304 _log.info("Failsafe or expire close for " + con); … … 537 539 538 540 private void processConnect(SelectionKey key) { 539 NTCPConnection con = (NTCPConnection)key.attachment(); 541 final NTCPConnection con = (NTCPConnection)key.attachment(); 542 final SocketChannel chan = con.getChannel(); 540 543 try { 541 SocketChannel chan = con.getChannel();542 544 boolean connected = chan.finishConnect(); 543 545 if (_log.shouldLog(Log.DEBUG)) … … 588 590 */ 589 591 private void processRead(SelectionKey key) { 590 NTCPConnection con = (NTCPConnection)key.attachment(); 592 final NTCPConnection con = (NTCPConnection)key.attachment(); 593 final SocketChannel chan = con.getChannel(); 591 594 ByteBuffer buf = null; 592 595 try { … … 596 599 int readThisTime; 597 600 int readCount = 0; 598 while ((readThisTime = c on.getChannel().read(buf)) > 0) {601 while ((readThisTime = chan.read(buf)) > 0) { 599 602 read += readThisTime; 600 603 readCount++; … … 606 609 if (read < 0) { 607 610 if (con.isInbound() && con.getMessagesReceived() <= 0) { 608 InetAddress addr = c on.getChannel().socket().getInetAddress();611 InetAddress addr = chan.socket().getInetAddress(); 609 612 int count; 610 613 if (addr != null) { … … 686 689 releaseBuf(buf); 687 690 if (con.isInbound() && con.getMessagesReceived() <= 0) { 688 InetAddress addr = c on.getChannel().socket().getInetAddress();691 InetAddress addr = chan.socket().getInetAddress(); 689 692 int count; 690 693 if (addr != null) { … … 732 735 */ 733 736 private void processWrite(SelectionKey key) { 734 NTCPConnection con = (NTCPConnection)key.attachment(); 737 final NTCPConnection con = (NTCPConnection)key.attachment(); 738 final SocketChannel chan = con.getChannel(); 735 739 try { 736 740 while (true) { … … 741 745 continue; 742 746 } 743 int written = c on.getChannel().write(buf);747 int written = chan.write(buf); 744 748 //totalWritten += written; 745 749 if (written == 0) { … … 846 850 847 851 while ((con = _wantsConRegister.poll()) != null) { 852 final SocketChannel schan = con.getChannel(); 848 853 try { 849 SelectionKey key = con.getChannel().register(_selector, SelectionKey.OP_CONNECT);854 SelectionKey key = schan.register(_selector, SelectionKey.OP_CONNECT); 850 855 key.attach(con); 851 856 con.setKey(key); … … 858 863 throw new IOException("Invalid NTCP address: " + naddr); 859 864 InetSocketAddress saddr = new InetSocketAddress(InetAddress.getByAddress(ip), port); 860 boolean connected = con.getChannel().connect(saddr);865 boolean connected = schan.connect(saddr); 861 866 if (connected) { 862 867 // Never happens, we use nonblocking -
router/java/src/net/i2p/router/transport/ntcp/NTCPConnection.java
r20413f0 racf5c31 289 289 * Valid for inbound; valid for outbound shortly after creation 290 290 */ 291 public SocketChannel getChannel() { return _chan; }291 public synchronized SocketChannel getChannel() { return _chan; } 292 292 293 293 /** 294 294 * Valid for inbound; valid for outbound shortly after creation 295 295 */ 296 public SelectionKey getKey() { return _conKey; }297 public void setChannel(SocketChannel chan) { _chan = chan; }298 public void setKey(SelectionKey key) { _conKey = key; }296 public synchronized SelectionKey getKey() { return _conKey; } 297 public synchronized void setChannel(SocketChannel chan) { _chan = chan; } 298 public synchronized void setKey(SelectionKey key) { _conKey = key; } 299 299 300 300 public boolean isInbound() { return _isInbound; } … … 1126 1126 * as it occurs in the selector thread) 1127 1127 */ 1128 void outboundConnected() { 1128 synchronized void outboundConnected() { 1129 if (_establishState == EstablishBase.FAILED) { 1130 _conKey.cancel(); 1131 return; 1132 } 1129 1133 _conKey.interestOps(_conKey.interestOps() | SelectionKey.OP_READ); 1130 1134 // schedule up the beginning of our handshaking by calling prepareNextWrite on the
Note: See TracChangeset
for help on using the changeset viewer.