From 8f04fe102d55b1082ac7fe87246a81ff16a2b868 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Tue, 23 Nov 2010 02:29:26 +0000 Subject: [PATCH] We're not restricting things to a set of ports, so don't act like we're going to. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6299 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../java/com/threerings/nio/PolicyServer.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/threerings/nio/PolicyServer.java b/src/main/java/com/threerings/nio/PolicyServer.java index fe6898def..fd277f108 100644 --- a/src/main/java/com/threerings/nio/PolicyServer.java +++ b/src/main/java/com/threerings/nio/PolicyServer.java @@ -22,6 +22,7 @@ package com.threerings.nio; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.nio.channels.SocketChannel; import com.google.inject.Inject; @@ -40,7 +41,7 @@ import static com.threerings.NaryaLog.log; /** * Binds to a port and responds to "xmlsocket" requests on it with a policy file allowing access - * to a given set of ports on a given hostname. + * to all ports on a given hostname. */ @Singleton public class PolicyServer extends ConnectionManager @@ -52,9 +53,11 @@ public class PolicyServer extends ConnectionManager super(cycle, mgr); } - public void init (int socketPolicyPort, String publicServerHost, int[] serverPorts, - int gameServerPort) - throws IOException + /** + * Accepts xmlsocket requests on socketPolicyPort and responds that + * publicServerHost may connect to any port on this host. + */ + public void init (int socketPolicyPort, String publicServerHost) { _acceptor = new ServerSocketChannelAcceptor(publicServerHost, new int[] { socketPolicyPort }, this); @@ -69,19 +72,15 @@ public class PolicyServer extends ConnectionManager for (String host : new String[] { publicServerHost }) { policy.append(" \n"); - */ - policy.append("*\"/>\n"); + policy.append(" to-ports=\"*\"/>\n"); } policy.append("\n"); - _policy = policy.toString().getBytes("UTF-8"); + try { + _policy = policy.toString().getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new IllegalStateException("UTF-8 encoding missing; this vm is broken", e); + } start(); }