| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
. "$(dirname "$0")/../util/lib.sh" |
| 5 |
|
| 6 |
init |
| 7 |
|
| 8 |
generate_certs_for testserver |
| 9 |
add_user user@testserver secretpassword |
| 10 |
|
| 11 |
# Note we run the server with minimal logging, to avoid generating very large |
| 12 |
# log files, which are not very useful anyway. |
| 13 |
mkdir -p .logs |
| 14 |
chasquid -v=-1 --logfile=.logs/chasquid.log --config_dir=config & |
| 15 |
wait_until_ready 1025 |
| 16 |
|
| 17 |
echo "Peak RAM: $(chasquid_ram_peak)" |
| 18 |
|
| 19 |
# Set connection count to (max open files) - (leeway). |
| 20 |
# We set the leeway to account for file descriptors opened by the runtime and |
| 21 |
# listeners; 20 should be enough for now. |
| 22 |
# Cap it to 2000, as otherwise it can be problematic due to port availability. |
| 23 |
COUNT=$(( $(ulimit -n) - 20 )) |
| 24 |
if [ $COUNT -gt 2000 ]; then |
| 25 |
COUNT=2000 |
| 26 |
fi |
| 27 |
|
| 28 |
if ! conngen -logtime -addr=localhost:1025 -count=$COUNT; then |
| 29 |
tail -n 1 .logs/chasquid.log |
| 30 |
fail "conngen error" |
| 31 |
fi |
| 32 |
|
| 33 |
echo "Peak RAM: $(chasquid_ram_peak)" |
| 34 |
|
| 35 |
success |