Changeset 0e94162 for apps/streaming


Ignore:
Timestamp:
May 25, 2016 2:55:30 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6b8cb54
Parents:
2a739f5
Message:

Streaming: Return I2PSocketAddress from StandardSocket? methods (ticket #1321)

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

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/impl/StandardServerSocket.java

    r2a739f5 r0e94162  
    1111import net.i2p.I2PException;
    1212import net.i2p.client.streaming.I2PSocket;
     13import net.i2p.client.streaming.I2PSocketAddress;
    1314
    1415/**
     
    100101
    101102    /**
    102      *  @return null always
     103     *  Port in returned SocketAddress will be zero.
     104     *
     105     *  @return an I2PSocketAddress as of 0.9.26; prior to that, returned null
     106     *  @since implemented in 0.9.26
    103107     */
    104108    @Override
    105109    public SocketAddress getLocalSocketAddress() {
    106         return null;
     110        return new I2PSocketAddress(_socket.getManager().getSession().getMyDestination(), 0);
    107111    }
    108112
  • apps/streaming/java/src/net/i2p/client/streaming/impl/StandardSocket.java

    r2a739f5 r0e94162  
    1111
    1212import net.i2p.client.streaming.I2PSocket;
     13import net.i2p.client.streaming.I2PSocketAddress;
    1314import net.i2p.client.streaming.I2PSocketOptions;
    1415
     
    118119
    119120    /**
    120      *  @return null always
     121     *  @return an I2PSocketAddress as of 0.9.26; prior to that, returned null
     122     *  @since implemented in 0.9.26
    121123     */
    122124    @Override
    123125    public SocketAddress getLocalSocketAddress() {
    124         return null;
     126        return new I2PSocketAddress(_socket.getThisDestination(), _socket.getLocalPort());
    125127    }
    126128
     
    158160
    159161    /**
    160      *  @throws UnsupportedOperationException always
     162     *  @return an I2PSocketAddress as of 0.9.26; prior to that, threw UnsupportedOperationException
     163     *  @since implemented in 0.9.26
    161164     */
    162165    @Override
    163166    public SocketAddress getRemoteSocketAddress() {
    164         throw new UnsupportedOperationException();
     167        return new I2PSocketAddress(_socket.getPeerDestination(), _socket.getPort());
    165168    }
    166169
Note: See TracChangeset for help on using the changeset viewer.