diff options
author | Vincent Lucas <chenzo@jitsi.org> | 2012-06-08 16:53:48 +0000 |
---|---|---|
committer | Vincent Lucas <chenzo@jitsi.org> | 2012-06-08 16:53:48 +0000 |
commit | da9780acee344e22c681ce4d17adc119c7c7a68e (patch) | |
tree | 01e9bd488620e3bc023e8e8cd0bc8f6dd08dc920 /src/net/java/sip/communicator | |
parent | f85c316f6eb188e20b8a7522b7144467ec43fbf1 (diff) | |
download | jitsi-da9780acee344e22c681ce4d17adc119c7c7a68e.zip jitsi-da9780acee344e22c681ce4d17adc119c7c7a68e.tar.gz jitsi-da9780acee344e22c681ce4d17adc119c7c7a68e.tar.bz2 |
Updates ice4j library (revision #305): Corrects the received STUN packet address logged in pcap file. And corrects the received/send STUN packet address logged in pcap file for JingleNodes.
Diffstat (limited to 'src/net/java/sip/communicator')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesCandidateDatagramSocket.java | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesCandidateDatagramSocket.java b/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesCandidateDatagramSocket.java index 95fa709..54b6ba6 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesCandidateDatagramSocket.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/JingleNodesCandidateDatagramSocket.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.net.*; import org.ice4j.*; +import org.ice4j.stack.*; /** * Represents an application-purposed (as opposed to an ICE-specific) @@ -70,12 +71,56 @@ public class JingleNodesCandidateDatagramSocket extends DatagramSocket int dataOffset = p.getOffset(); /* send to Jingle Nodes relay address on local port */ - DatagramPacket packet = new DatagramPacket(data, dataOffset, dataLen, - new InetSocketAddress(localEndPoint.getAddress(), - localEndPoint.getPort())); + DatagramPacket packet = new DatagramPacket( + data, + dataOffset, + dataLen, + new InetSocketAddress( + localEndPoint.getAddress(), + localEndPoint.getPort())); //XXX reuse an existing DatagramPacket ? super.send(packet); + + // no exception packet is successfully sent, log it + if(StunStack.isPacketLoggerEnabled()) + { + StunStack.getPacketLogger().logPacket( + super.getLocalAddress().getAddress(), + super.getLocalPort(), + packet.getAddress().getAddress(), + packet.getPort(), + packet.getData(), + true); + } + } + + + /** + * Receives a <tt>DatagramPacket</tt> from this socket. The DatagramSocket + * is overridden to log the received packet into the "pcap" (packet capture) + * log. + * + * @param p <tt>DatagramPacket</tt> + * @throws IOException if something goes wrong + */ + @Override + public void receive(DatagramPacket p) + throws IOException + { + super.receive(p); + + // no exception packet is successfully received, log it + if(StunStack.isPacketLoggerEnabled()) + { + StunStack.getPacketLogger().logPacket( + p.getAddress().getAddress(), + p.getPort(), + super.getLocalAddress().getAddress(), + super.getLocalPort(), + p.getData(), + false); + } } /** |