agoo 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agoo might be problematic. Click here for more details.

@@ -1,54 +0,0 @@
1
- // Copyright (c) 2018, Peter Ohler, All rights reserved.
2
-
3
- #include "pub.h"
4
- #include "queue.h"
5
- #include "server.h"
6
- #include "subscription.h"
7
-
8
- static VALUE subscription_class = Qundef;
9
-
10
- VALUE
11
- subscription_new(uint64_t cid, uint64_t id, VALUE handler) {
12
- Subscription s = ALLOC(struct _Subscription);
13
-
14
- s->cid = cid;
15
- s->id = id;
16
- s->handler = handler;
17
- s->self = Data_Wrap_Struct(subscription_class, NULL, xfree, s);
18
-
19
- return s->self;
20
- }
21
-
22
- /* Document-method: close
23
- *
24
- * call-seq: close()
25
- *
26
- * Close or unsubscribe a subscription.
27
- */
28
- static VALUE
29
- subscription_close(VALUE self) {
30
- Subscription s = DATA_PTR(self);
31
-
32
- if (0 != s->cid && 0 != s->id) {
33
- Pub p = pub_unsubscribe(s->cid, s->id);
34
-
35
- queue_push(&the_server.pub_queue, (void*)p);
36
- queue_wakeup(&the_server.pub_queue);
37
- s->cid = 0;
38
- s->id = 0;
39
- }
40
- return Qnil;
41
- }
42
-
43
- /* Document-class: Agoo::Subscription
44
- *
45
- * The handle on a subscriptionscription used to register interest in messages
46
- * published on a subscriptionject. Published messages are delivered to Javascript
47
- * clients.
48
- */
49
- void
50
- subscription_init(VALUE mod) {
51
- subscription_class = rb_define_class_under(mod, "Subscription", rb_cObject);
52
-
53
- rb_define_method(subscription_class, "close", subscription_close, 0);
54
- }
@@ -1,18 +0,0 @@
1
- // Copyright (c) 2018, Peter Ohler, All rights reserved.
2
-
3
- #ifndef __AGOO_SUBSCRIPTION_H__
4
- #define __AGOO_SUBSCRIPTION_H__
5
-
6
- #include <ruby.h>
7
-
8
- typedef struct _Subscription {
9
- VALUE self;
10
- uint64_t cid;
11
- uint64_t id;
12
- VALUE handler;
13
- } *Subscription;
14
-
15
- extern void subscription_init(VALUE mod);
16
- extern VALUE subscription_new(uint64_t cid, uint64_t id, VALUE handler);
17
-
18
- #endif // __AGOO_SUBSCRIPTION_H__