Fix duplicate sever-port bug

cros_copy_upgrade_server had a bug where it would always start servers
on port 8081 regrdless of whether that port was free.  This was a bug
in the "get next free port" code.

BUG=chromium-os:4776
TEST=Reran multiple instances at once, run netstat -nlt

Review URL: http://codereview.chromium.org/2975006
This commit is contained in:
Paul Stewart 2010-07-13 07:59:15 -07:00
parent 8ae113bb42
commit bd2871a43a

View File

@ -118,7 +118,7 @@ start_server () {
# Find a TCP listen socket that is not in use
ssh ${FLAGS_upgrade_server} "netstat -lnt" | awk '{ print $4 }' > $portlist
server_port=8081
while grep -q ":${port}$" $portlist; do
while grep -q ":${server_port}$" $portlist; do
server_port=$[server_port + 1]
done
rm -f $portlist