summaryrefslogtreecommitdiff
path: root/ebus-racket/inserter.rkt
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2012-03-05 22:27:22 +0100
committerYves Fischer <yvesf-git@xapek.org>2012-03-05 22:27:22 +0100
commitc6753ed8974da8090037a52d65415143ebf1c015 (patch)
tree6f66a2c4e83a7f9df55e9d9328cbf125818cc379 /ebus-racket/inserter.rkt
parent312fc443d91af010051e278e03830aa5ffaa4c9c (diff)
downloadebus-alt-c6753ed8974da8090037a52d65415143ebf1c015.tar.gz
ebus-alt-c6753ed8974da8090037a52d65415143ebf1c015.zip
ebus-racket: tcp repl (--tcp-repl <port>)
Diffstat (limited to 'ebus-racket/inserter.rkt')
-rwxr-xr-xebus-racket/inserter.rkt14
1 files changed, 10 insertions, 4 deletions
diff --git a/ebus-racket/inserter.rkt b/ebus-racket/inserter.rkt
index 9aaca78..a2ee1a0 100755
--- a/ebus-racket/inserter.rkt
+++ b/ebus-racket/inserter.rkt
@@ -6,7 +6,8 @@
racket/match
"db.rkt"
"layer7.rkt"
- "layer2.rkt")
+ "layer2.rkt"
+ "tcp-repl.rkt")
(define logger (make-logger 'ebus-inserter (current-logger)))
@@ -41,6 +42,8 @@
(flush-output)])
(loop))))))
+(define-namespace-anchor repl-ns-anchor)
+
(define (main)
;; Parse commandline
(command-line
@@ -48,6 +51,8 @@
[("-c" "--connect") host port "Connect to server <host> <port>"
(connect-host? host)
(connect-port? (string->number port))]
+ ["--tcp-repl" port "Open REPL on TCP <port>"
+ (tcp-repl-run (namespace-anchor->namespace repl-ns-anchor) (string->number port))]
["--debug-layer2" "Log level for Layer 2 Parser"
(loglevel-layer2? 'debug)]
["--debug-db" "Log level for DB"
@@ -67,18 +72,19 @@
(start-logger-thread (make-log-receiver logger 'info)
(make-log-receiver db-logger (loglevel-db?))
(make-log-receiver layer2-logger (loglevel-layer2?))
- (make-log-receiver layer7-logger 'info))
+ (make-log-receiver layer7-logger 'info)
+ (make-log-receiver tcp-repl-logger 'info))
;; Test Database Connection
(when (not (db-pgc-test))
- (display "Failed to connect database")
+ (log-message logger 'fatal "Failed to connect to database" #t)
(exit 1))
;; Connect, replacing input with tcp connection
(if (or (null? (connect-host?)) (null? (connect-port?)))
(log-message (current-logger) 'info "Using stdin" #t)
(let-values ([(cin cout) (tcp-connect (connect-host?) (connect-port?))])
- (display (format "Connected to ~s ~s ~n" (connect-host?) (connect-port?)))
+ (log-message logger 'info (format "Connected to ~s ~s ~n" (connect-host?) (connect-port?)) #t)
(current-input-port cin)))
;; Process Ebus Packets