Megatest

Check-in [8e59940d89]
Login
Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.6584-tcp6
Files: files | file ages | folders
SHA1: 8e59940d89b83a2fa141f89d2bb4ca36c9a5de67
User & Date: matt on 2021-05-29 05:15:21
Other Links: branch diff | manifest | tags
Context
2021-06-01
05:43
wip, getting closer to tcp6 based approach working check-in: 0dbc0e6225 user: matt tags: v1.6584-tcp6
2021-05-29
05:15
wip check-in: 8e59940d89 user: matt tags: v1.6584-tcp6
04:41
wip check-in: 84a9509203 user: matt tags: v1.6584-tcp6
Changes

Modified rmtmod.scm from [46b3357985] to [df6ad4612b].

147
148
149
150
151
152
153
154


155
156
157
158
159
160
161
  (dbname   #f)
  (fullname #f)
  (hostport #f)
  (ipaddr   #f)
  (port     #f)
  (srvpkt   #f)
  (lastmsg  0)
  (expires  0))



;;======================================================================
;;  S U P P O R T   F U N C T I O N S
;;======================================================================

;; replaces *runremote*
(define *rmt:remote* (make-rmt:remote))







|
>
>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
  (dbname   #f)
  (fullname #f)
  (hostport #f)
  (ipaddr   #f)
  (port     #f)
  (srvpkt   #f)
  (lastmsg  0)
  (expires  0)
  (inport   #f)
  (outport  #f))

;;======================================================================
;;  S U P P O R T   F U N C T I O N S
;;======================================================================

;; replaces *runremote*
(define *rmt:remote* (make-rmt:remote))
266
267
268
269
270
271
272
273

274
275


276
277
278
279
280
281
282
283


284


285


286
287
288
289
290
291
292
293
294
295
296
297
  (if (not *rmt:remote*)(set! *rmt:remote* (make-rmt:remote)))
  (let* ((apath *toppath*)
	 (conns *rmt:remote*)
	 (dbname (db:run-id->dbname rid)))
    (rmt:general-open-connection conns apath dbname)
    (rmt:send-receive-real conns apath dbname cmd params)))

(define (rmt:send-receive-real host port data)

  (let-values ((i o) (tcp-connect host port))
    (write-line data o)


    (print (read-line i))))
  
;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future
;;
#;(define (rmt:send-receive-real remote apath dbname cmd params)
  (let* ((conn (rmt:get-conn remote apath dbname)))
    (assert conn "FATAL: rmt:send-receive-real called without the needed channels opened")


    (let* ((payload (sexpr->string params))


	   (res      (with-input-from-request


		      (rmt:conn->uri conn "api")
		      `((params . ,payload)
			(cmd    . ,cmd)
			(key    . "nokey"))
		      read-string)))
      (if (string? res)
	  (string->sexpr res)
	  res))))

;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future.
;;







|
>
|
<
>
>
|




|


>
>
|
>
>
|
>
>
|
<
<
<
|







268
269
270
271
272
273
274
275
276
277

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296



297
298
299
300
301
302
303
304
  (if (not *rmt:remote*)(set! *rmt:remote* (make-rmt:remote)))
  (let* ((apath *toppath*)
	 (conns *rmt:remote*)
	 (dbname (db:run-id->dbname rid)))
    (rmt:general-open-connection conns apath dbname)
    (rmt:send-receive-real conns apath dbname cmd params)))

(define (rmt:send-receive-setup conn)
  (if (not (rmt:conn-inport conn))
      (let-values ((i o) (tcp-connect (rmt:conn-ipaddr conn)

				      (rmt:conn-port port)))
	(rmt:conn-inport-set! conn i)
	(rmt:conn-outport-set! conn o))))
  
;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future
;;
(define (rmt:send-receive-real remote apath dbname cmd params)
  (let* ((conn (rmt:get-conn remote apath dbname)))
    (assert conn "FATAL: rmt:send-receive-real called without the needed channels opened")
    (rmt:send-receive-setup conn)
    (let* ((key     #f)
	   (payload (sexpr->string `((cmd . ,cmd)
				     (key . ,key)
				     (params . ,params))))
	   (res      (begin
		       (write payload (rmt:conn-outport conn))
		       (with-input-from-port
			   (rmt:conn-inport conn)



			 read-string))))
      (if (string? res)
	  (string->sexpr res)
	  res))))

;; db is at apath/.db/dbname, rid is an intermediary solution and will be removed
;; sometime in the future.
;;