Changeset 6081856


Ignore:
Timestamp:
Nov 25, 2015 2:48:43 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5d07294
Parents:
110a0a1
Message:

client demo cleanup

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

Legend:

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

    r110a0a1 r6081856  
    1414public class SAMEventHandler extends SAMClientEventListenerImpl {
    1515    //private I2PAppContext _context;
    16     private Log _log;
     16    private final Log _log;
    1717    private Boolean _helloOk;
    18     private Object _helloLock = new Object();
     18    private final Object _helloLock = new Object();
    1919    private Boolean _sessionCreateOk;
    20     private Object _sessionCreateLock = new Object();
    21     private Object _namingReplyLock = new Object();
    22     private Map<String,String> _namingReplies = new HashMap<String,String>();
     20    private final Object _sessionCreateLock = new Object();
     21    private final Object _namingReplyLock = new Object();
     22    private final Map<String,String> _namingReplies = new HashMap<String,String>();
    2323
    2424    public SAMEventHandler(I2PAppContext ctx) {
  • apps/sam/java/src/net/i2p/sam/client/SAMReader.java

    r110a0a1 r6081856  
    1717 */
    1818public class SAMReader {
    19     private Log _log;
    20     private InputStream _inRaw;
    21     private SAMClientEventListener _listener;
    22     private boolean _live;
     19    private final Log _log;
     20    private final InputStream _inRaw;
     21    private final SAMClientEventListener _listener;
     22    private volatile boolean _live;
    2323   
    2424    public SAMReader(I2PAppContext context, InputStream samIn, SAMClientEventListener listener) {
     
    3333        t.start();
    3434    }
     35
    3536    public void stopReading() { _live = false; }
    3637   
  • apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java

    r110a0a1 r6081856  
    2121 */
    2222public class SAMStreamSend {
    23     private I2PAppContext _context;
    24     private Log _log;
    25     private String _samHost;
    26     private String _samPort;
    27     private String _destFile;
    28     private String _dataFile;
    29     private String _conOptions;
     23    private final I2PAppContext _context;
     24    private final Log _log;
     25    private final String _samHost;
     26    private final String _samPort;
     27    private final String _destFile;
     28    private final String _dataFile;
     29    private final String _conOptions;
    3030    private Socket _samSocket;
    3131    private OutputStream _samOut;
     
    3333    private SAMReader _reader;
    3434    //private boolean _dead;
    35     private SAMEventHandler _eventHandler;
     35    private final SAMEventHandler _eventHandler;
    3636    /** Connection id (Integer) to peer (Flooder) */
    37     private Map<Integer, Sender> _remotePeers;
     37    private final Map<Integer, Sender> _remotePeers;
    3838   
    3939    public static void main(String args[]) {
     
    166166        private String _remoteDestination;
    167167        private InputStream _in;
    168         private boolean _closed;
     168        private volatile boolean _closed;
    169169        private long _started;
    170170        private long _totalSent;
    171171       
    172         public Sender() {
    173             _closed = false;
    174         }
     172        public Sender() {}
    175173       
    176174        public boolean openConnection() {
  • apps/sam/java/src/net/i2p/sam/client/SAMStreamSink.java

    r110a0a1 r6081856  
    2121 */
    2222public class SAMStreamSink {
    23     private I2PAppContext _context;
    24     private Log _log;
    25     private String _samHost;
    26     private String _samPort;
    27     private String _destFile;
    28     private String _sinkDir;
    29     private String _conOptions;
     23    private final I2PAppContext _context;
     24    private final Log _log;
     25    private final String _samHost;
     26    private final String _samPort;
     27    private final String _destFile;
     28    private final String _sinkDir;
     29    private final String _conOptions;
    3030    private Socket _samSocket;
    3131    private OutputStream _samOut;
     
    3333    private SAMReader _reader;
    3434    //private boolean _dead;
    35     private SAMEventHandler _eventHandler;
     35    private final SAMEventHandler _eventHandler;
    3636    /** Connection id (Integer) to peer (Flooder) */
    37     private Map<Integer, Sink> _remotePeers;
     37    private final Map<Integer, Sink> _remotePeers;
    3838   
    3939    public static void main(String args[]) {
     
    201201   
    202202    private class Sink {
    203         private int _connectionId;
    204         private String _remoteDestination;
    205         private boolean _closed;
    206         private long _started;
     203        private final int _connectionId;
     204        private final String _remoteDestination;
     205        private volatile boolean _closed;
     206        private final long _started;
    207207        private long _lastReceivedOn;
    208         private OutputStream _out;
     208        private final OutputStream _out;
    209209       
    210210        public Sink(int conId, String remDest) throws IOException {
     
    223223            File out = File.createTempFile("sink", ".dat", sinkDir);
    224224            _out = new FileOutputStream(out);
     225            _started = _context.clock().now();
    225226        }
    226227       
Note: See TracChangeset for help on using the changeset viewer.