aboutsummaryrefslogtreecommitdiffstats
path: root/l/src/call-id.lisp
diff options
context:
space:
mode:
authorTeddy Wing2021-02-04 00:16:36 +0100
committerTeddy Wing2021-02-04 00:22:04 +0100
commit5beb4694cf112bb0261d0915cf54201109f7ea2d (patch)
tree91804d14f87ebbdb02baa981fbc08aa26b673cc7 /l/src/call-id.lisp
parentc9f396fffa84f7178b5ee929cfb412485ee256b3 (diff)
downloadextreload-5beb4694cf112bb0261d0915cf54201109f7ea2d.tar.bz2
Make DevTools Protocol call ID auto-incrementing
Remove the hard-coded call IDs and replace them with a class that keeps track of the current call ID and allows for easy incrementing to get the next ID. This should allow us to give multiple extension IDs on the command line and send messages with properly incrementing call IDs. Didn't touch the `runtime-evaluate-msg` message call ID because that one is local to the target it's attached to, so we can keep it at ID "1".
Diffstat (limited to 'l/src/call-id.lisp')
-rw-r--r--l/src/call-id.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/l/src/call-id.lisp b/l/src/call-id.lisp
new file mode 100644
index 0000000..bf0bcec
--- /dev/null
+++ b/l/src/call-id.lisp
@@ -0,0 +1,12 @@
+(in-package :extreload)
+
+(defclass call-id ()
+ ((id
+ :initform 0
+ :documentation "Current call ID.")))
+
+(defgeneric next-call-id (call-id)
+ (:documentation "Increment the call ID and return the result."))
+
+(defmethod next-call-id ((call-id call-id))
+ (incf (slot-value call-id 'id)))