Browse Source

Fix sending of keyword arguments over CapTP

We need to ensure that when we send keyword arguments over CapTP we
gather them up and include them at the end of the arg list. before we
were ignoring keyword arguments when sending a message over CapTP, this
fixes that.
fix-gitlab-ci
Jessica Tallon 3 years ago
parent
commit
0f0ce4fe15
  1. 15
      goblins/ocapn/captp.rkt

15
goblins/ocapn/captp.rkt

@ -831,6 +831,15 @@
[other-message
(error 'invalid-message "~a" other-message)]))
(define (keyword-args->args kws kw-vals args)
(if (null? kws)
args
(for/fold ([args (reverse args)]
#:result (reverse args))
([kw kws]
[kw-val kw-vals])
(cons kw-val (cons kw args)))))
(define ((^internal-handler bcom) cmd)
(define (running-handle-cmd cmd)
(match cmd
@ -843,18 +852,20 @@
(values msg (question-finder->question-pos! answer-this-question))]))
(match-define (message to resolve-me kws kw-vals args)
real-msg)
(define collected-args
(keyword-args->args kws kw-vals args))
(define deliver-msg
(if resolve-me
(op:deliver (marshall-to to)
#;(desc:import (maybe-install-export! to))
#f ;; TODO: support methods
;; TODO: correctly marshall everything here
(outgoing-pre-marshall! args)
(outgoing-pre-marshall! collected-args)
answer-pos
(marshall-local-refr! resolve-me))
(op:deliver-only (marshall-to to)
#f ;; TODO: support methods
(outgoing-pre-marshall! args))))
(outgoing-pre-marshall! collected-args))))
(send-to-remote deliver-msg)]
[(cmd-send-listen (? remote-refr? to-refr) (? local-refr? listener-refr)
(? boolean? wants-partial?))

Loading…
Cancel
Save