Commit 82bccaca authored by Thiago Camargo's avatar Thiago Camargo Committed by thiago

Improved Security

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6686 b35dd754-fafc-0310-a699-88a17e54d16e
parent e5803eeb
...@@ -117,22 +117,21 @@ public class SmartSession extends MediaProxySession { ...@@ -117,22 +117,21 @@ public class SmartSession extends MediaProxySession {
public void run() { public void run() {
try { try {
long c = 0; long c = 0;
long band = System.currentTimeMillis();
while (true) { while (true) {
// Block until a datagram appears: // Block until a datagram appears:
packet = new DatagramPacket(buf, buf.length); packet = new DatagramPacket(buf, buf.length);
dataSocket.receive(packet); dataSocket.receive(packet);
if (this.getPort() != packet.getPort()) // Relay Destination
System.out.println(dataSocket.getLocalAddress().getHostAddress() + ":" + dataSocket.getLocalPort() + " relay to: " + packet.getAddress().getHostAddress() + ":" + packet.getPort()); if (c++ < 100) { // 100 packets are enough to discover relay address
if (c++ < 5) {
System.out.println("Received:" + dataSocket.getLocalAddress().getHostAddress() + ":" + dataSocket.getLocalPort());
System.out.println("Addr: " + packet.getAddress().getHostName());
}
this.setHost(packet.getAddress()); this.setHost(packet.getAddress());
this.setPort(packet.getPort()); this.setPort(packet.getPort());
} else {
c = 1000; // Prevents long overflow
// Check Source Address. If its different, discard packet.
if (!this.getHost().equals(packet.getAddress())) continue;
}
boolean resend = true; boolean resend = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment