47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
;; all routes though here end in exit ...
;;
;; start_server
;;
(define (server:launch run-id transport-type)
(BB> "server:launch fired for run-id="run-id" transport-type="transport-type)
(case transport-type
((http)(http-transport:launch run-id))
;;((nmsg)(nmsg-transport:launch run-id))
((rpc) (rpc-transport:launch run-id))
(else (debug:print-error 0 *default-log-port* "unknown server type " transport-type))))
;; (else (debug:print-error 0 *default-log-port* "No known transport set, transport=" transport ", using rpc")
;; (rpc-transport:launch run-id)))))
;;======================================================================
;; S E R V E R U T I L I T I E S
;;======================================================================
;; set global *transport-type* based on -transport switch and serer/transport configuration. default http otherwise.
;; called by launch:setup
(define (server:set-transport)
(let ((ttype (string->symbol
(or (args:get-arg "-transport")
(configf:lookup *configdat* "server" "transport")
"http"))))
(set! *transport-type* ttype)
ttype))
;; Get the transport -- DO NOT call this from client code. In client code, this is run-id sensitive and not a global
;; For code communicating with existing run-id with a server, use: (rmt:run-id->transport-type run-id)
(define (server:get-transport)
(if *transport-type*
|
>
|
|
|
|
|
|
|
|
>
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
;; all routes though here end in exit ...
;;
;; start_server
;;
(define (server:launch run-id transport-type)
(BB> "server:launch fired for run-id="run-id" transport-type="transport-type)
(let ((ttype (if (symbol? transport-type) transport-type (string->symbol (->string transport-type)))))
(case ttype
((http)(http-transport:launch run-id))
;;((nmsg)(nmsg-transport:launch run-id))
((rpc) (rpc-transport:launch run-id))
(else (debug:print-error 0 *default-log-port* "unknown server type " ttype)))))
;; (else (debug:print-error 0 *default-log-port* "No known transport set, transport=" transport ", using rpc")
;; (rpc-transport:launch run-id)))))
;;======================================================================
;; S E R V E R U T I L I T I E S
;;======================================================================
;; set global *transport-type* based on -transport switch and serer/transport configuration. default http otherwise.
;; called by launch:setup
(define (server:set-transport)
(let ((ttype (string->symbol
(or (args:get-arg "-transport")
(configf:lookup *configdat* "server" "transport")
"rpc"))))
(BB> "TRANSPORT IS "ttype" string?"(string? ttype)" symbol?"(symbol? ttype))
(set! *transport-type* ttype)
ttype))
;; Get the transport -- DO NOT call this from client code. In client code, this is run-id sensitive and not a global
;; For code communicating with existing run-id with a server, use: (rmt:run-id->transport-type run-id)
(define (server:get-transport)
(if *transport-type*
|