summaryrefslogtreecommitdiff
path: root/ebus-racket/inserter.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'ebus-racket/inserter.rkt')
-rwxr-xr-xebus-racket/inserter.rkt18
1 files changed, 10 insertions, 8 deletions
diff --git a/ebus-racket/inserter.rkt b/ebus-racket/inserter.rkt
index a2ee1a0..bd23e04 100755
--- a/ebus-racket/inserter.rkt
+++ b/ebus-racket/inserter.rkt
@@ -2,7 +2,6 @@
#lang racket/base
(require racket/cmdline
racket/tcp
- racket/pretty
racket/match
"db.rkt"
"layer7.rkt"
@@ -22,12 +21,15 @@
(log-message logger 'info (format "Field: ~a" field) #t)
(when (insert?)
(apply db-insert-field field))))
-
-(define (read-ebus-loop7 input-port)
- (let ([fields (layer7-read-ebus (current-input-port))])
- (when (not (or (void? fields) (eof-object? fields)))
- (handle-fields fields))
- (cond ((not (eof-object? fields)) (read-ebus-loop7 input-port)))))
+
+(define (make-ebus-loop7 input-port)
+ (lambda ()
+ (let loop ()
+ (let ([fields (layer7-read-ebus (current-input-port))])
+ (when (not (or (void? fields) (eof-object? fields)))
+ (handle-fields fields))
+ (when (not (eof-object? fields))
+ (loop))))))
;; Start Thread that observe all given log-receivers
(define (start-logger-thread receiver1 . receiverN)
@@ -88,7 +90,7 @@
(current-input-port cin)))
;; Process Ebus Packets
- (read-ebus-loop7 (current-input-port))
+ ((make-ebus-loop7 (current-input-port)) )
)
(exit (main))