Permalink
Browse files

options where they're useful, none when they're not

  • Loading branch information...
1 parent 463eb8f commit 98d8d7fb45525a3e7dee97f936df2251c58a805c @jneen committed Jan 11, 2011
Showing with 11 additions and 5 deletions.
  1. +7 −0 lib/balls.sh
  2. +4 −5 lib/server.sh
View
@@ -1,5 +1,12 @@
#!/bin/bash
[[ -z "$BALLS_LIB" ]] && BALLS_LIB=$(dirname $0)
+
+[[ -z "$TMP_DIR" ]] && TMP_DIR=/tmp/balls
+[[ -d "$TMP_DIR" ]] && mkdir "$TMP_DIR"
+
+[[ -z "$BALLS_PORT" ]] && BALLS_PORT=3000
+
+
. $BALLS_LIB/util.sh
. $BALLS_LIB/http.sh
. $BALLS_LIB/router.sh
View
@@ -1,17 +1,16 @@
#!/bin/bash
-TMP_DIR=./tmp
_hash() {
echo $$.$(date +'%s.%N').$RANDOM
}
balls::server() {
- local http_sock=$BALLS_SOCK
- [ -z "$http_sock" ] && http_sock=$TMP_DIR/balls.http.sock
+ http_sock=$TMP_DIR/balls.http.$$.sock
+
[ -p $http_sock ] || mkfifo $http_sock
- while true ; do
- cat $http_sock | nc -l -p 9009 | (
+ while true; do
+ cat $http_sock | nc -l -p $BALLS_PORT | (
headers_sock=$TMP_DIR/balls.headers.$(_hash).sock
[ -p $headers_sock ] || mkfifo $headers_sock

0 comments on commit 98d8d7f

Please sign in to comment.