Fix WebSocketServer allowed port range 42/38542/1
authorRyan Goulding <ryandgoulding@gmail.com>
Sun, 8 May 2016 00:43:09 +0000 (20:43 -0400)
committerRyan Goulding <ryandgoulding@gmail.com>
Sun, 8 May 2016 00:46:01 +0000 (20:46 -0400)
Operating systems generally limit binding to ports below 1024 to
super users.  However, 1024 is fine for normal users.  This change
augments the precondition check to allow for port 1024 if it is
specified.

Change-Id: I876ff1694371e0c71b94806a6a1b7dbf3b27950f
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/streams/websockets/WebSocketServer.java

index e19fe0ec5327b473136e41f74cdf3220aad63aab..011dc5c7838b885b0a87437c5e4c1f3e9f712ee5 100644 (file)
@@ -43,7 +43,7 @@ public class WebSocketServer implements Runnable {
      */
     public static WebSocketServer createInstance(int port) {
         Preconditions.checkState(instance == null, "createInstance() has already been called");
-        Preconditions.checkArgument(port > 1024, "Privileged port (below 1024) is not allowed");
+        Preconditions.checkArgument(port >= 1024, "Privileged port (below 1024) is not allowed");
 
         instance = new WebSocketServer(port);
         return instance;