Changeset 626f541


Ignore:
Timestamp:
Nov 26, 2015 5:00:32 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
b9ab933
Parents:
9367aca
Message:

add FROM_PORT and TO_PORT to client

Location:
apps/sam/java/src/net/i2p/sam/client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java

    r9367aca r626f541  
    228228                _context.statManager().createRateStat("send." + _connectionId + ".lifetime", "How long we talk to a peer", "swarm", new long[] { 5*60*1000 });
    229229               
    230                 byte msg[] = ("STREAM CONNECT ID=" + _connectionId + " DESTINATION=" + _remoteDestination + "\n").getBytes();
     230                StringBuilder buf = new StringBuilder(1024);
     231                buf.append("STREAM CONNECT ID=").append(_connectionId).append(" DESTINATION=").append(_remoteDestination);
     232                // not supported until 3.2 but 3.0-3.1 will ignore
     233                if (_isV3)
     234                    buf.append(" FROM_PORT=1234 TO_PORT=5678");
     235                buf.append('\n');
     236                byte[] msg = DataHelper.getASCII(buf.toString());
    231237                synchronized (_samOut) {
    232238                    _samOut.write(msg);
  • apps/sam/java/src/net/i2p/sam/client/SAMStreamSink.java

    r9367aca r626f541  
    259259                    // only for v3
    260260                    //String req = "STREAM ACCEPT SILENT=true ID=" + _v3ID + "\n";
    261                     String req = "STREAM ACCEPT SILENT=false ID=" + _v3ID + "\n";
     261                    // TO_PORT not supported until 3.2 but 3.0-3.1 will ignore
     262                    String req = "STREAM ACCEPT SILENT=false TO_PORT=5678 ID=" + _v3ID + "\n";
    262263                    samOut.write(req.getBytes());
    263264                    samOut.flush();
     
    269270                    //    throw new IOException("Stream status failed");
    270271                    if (_log.shouldLog(Log.DEBUG))
    271                         _log.debug("got STREAM STATUS, awaiting connetion");
     272                        _log.debug("got STREAM STATUS, awaiting connection");
    272273                    return "OK";
    273274                }
Note: See TracChangeset for help on using the changeset viewer.