Support port range as -p/--port PORT[:HIGHPORT].

Extend mosh and mosh-server to support parsing a high port from
the desired_port argument.  The first (low) port must not be
greater than the second (high) port.
If only one value is provided, behaviour is as before; bind
to one port.  Also tweak the formatting in mosh-server(1) synopsis
to be consistent.

This resolves mosh issue # 296.

Signed-off-by: Luke Mewburn <luke@mewburn.net>
This commit is contained in:
Luke Mewburn
2012-10-27 18:38:05 +11:00
committed by Keith Winstein
parent b99da057bb
commit 141ec239da
6 changed files with 95 additions and 40 deletions
+3 -1
View File
@@ -101,7 +101,7 @@ namespace Network {
static const int CONGESTION_TIMESTAMP_PENALTY = 500; /* ms */
static bool try_bind( int socket, uint32_t addr, int port );
static bool try_bind( int socket, uint32_t addr, int port_low, int port_high );
class Socket
{
@@ -185,6 +185,8 @@ namespace Network {
}
void set_last_roundtrip_success( uint64_t s_success ) { last_roundtrip_success = s_success; }
static bool parse_portrange( const char * desired_port_range, int & desired_port_low, int & desired_port_high );
};
}