agoo 2.5.5 → 2.5.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of agoo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/ext/agoo/agoo.c +4 -3
- data/ext/agoo/atomic.h +120 -0
- data/ext/agoo/bind.c +52 -52
- data/ext/agoo/bind.h +13 -13
- data/ext/agoo/con.c +499 -481
- data/ext/agoo/con.h +47 -39
- data/ext/agoo/debug.c +42 -42
- data/ext/agoo/debug.h +1 -1
- data/ext/agoo/doc.c +17 -17
- data/ext/agoo/doc.h +12 -12
- data/ext/agoo/err.c +18 -18
- data/ext/agoo/err.h +27 -27
- data/ext/agoo/error_stream.c +9 -9
- data/ext/agoo/extconf.rb +3 -0
- data/ext/agoo/gqlintro.c +43 -43
- data/ext/agoo/gqlintro.h +1 -1
- data/ext/agoo/gqlvalue.c +131 -131
- data/ext/agoo/gqlvalue.h +32 -32
- data/ext/agoo/graphql.c +158 -158
- data/ext/agoo/graphql.h +34 -33
- data/ext/agoo/hook.c +15 -14
- data/ext/agoo/hook.h +18 -14
- data/ext/agoo/http.c +14 -14
- data/ext/agoo/http.h +4 -4
- data/ext/agoo/kinds.h +5 -5
- data/ext/agoo/log.c +232 -224
- data/ext/agoo/log.h +93 -93
- data/ext/agoo/method.h +17 -17
- data/ext/agoo/page.c +88 -86
- data/ext/agoo/page.h +21 -21
- data/ext/agoo/pub.c +36 -36
- data/ext/agoo/pub.h +23 -23
- data/ext/agoo/queue.c +37 -38
- data/ext/agoo/queue.h +20 -19
- data/ext/agoo/rack_logger.c +13 -13
- data/ext/agoo/ready.c +357 -0
- data/ext/agoo/ready.h +41 -0
- data/ext/agoo/req.c +11 -11
- data/ext/agoo/req.h +30 -31
- data/ext/agoo/request.c +46 -46
- data/ext/agoo/request.h +2 -2
- data/ext/agoo/res.c +40 -18
- data/ext/agoo/res.h +14 -14
- data/ext/agoo/response.c +6 -6
- data/ext/agoo/response.h +9 -9
- data/ext/agoo/rhook.c +3 -3
- data/ext/agoo/rhook.h +1 -1
- data/ext/agoo/rlog.c +47 -42
- data/ext/agoo/rlog.h +0 -1
- data/ext/agoo/rresponse.c +33 -33
- data/ext/agoo/rresponse.h +1 -1
- data/ext/agoo/rserver.c +184 -175
- data/ext/agoo/rserver.h +2 -2
- data/ext/agoo/rupgraded.c +41 -41
- data/ext/agoo/rupgraded.h +3 -3
- data/ext/agoo/sdl.c +80 -80
- data/ext/agoo/sdl.h +1 -1
- data/ext/agoo/seg.h +2 -2
- data/ext/agoo/server.c +143 -117
- data/ext/agoo/server.h +43 -42
- data/ext/agoo/sse.c +7 -7
- data/ext/agoo/sse.h +4 -4
- data/ext/agoo/subject.c +5 -5
- data/ext/agoo/subject.h +6 -6
- data/ext/agoo/text.c +21 -21
- data/ext/agoo/text.h +14 -13
- data/ext/agoo/upgraded.c +41 -40
- data/ext/agoo/upgraded.h +41 -40
- data/ext/agoo/websocket.c +42 -42
- data/ext/agoo/websocket.h +16 -16
- data/lib/agoo/version.rb +1 -1
- data/test/static_test.rb +2 -0
- metadata +5 -5
- data/ext/agoo/log_queue.h +0 -30
- data/ext/agoo/sub.c +0 -111
- data/ext/agoo/sub.h +0 -36
data/ext/agoo/sse.c
CHANGED
@@ -15,14 +15,14 @@ Connection: keep-alive\r\n\
|
|
15
15
|
\r\n\
|
16
16
|
retry: 5\n\n";
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
agooText
|
19
|
+
agoo_sse_upgrade(agooReq req, agooText t) {
|
20
20
|
t->len = 0; // reset
|
21
|
-
return
|
21
|
+
return agoo_text_append(t, up, sizeof(up) - 1);
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
t =
|
27
|
-
return
|
24
|
+
agooText
|
25
|
+
agoo_sse_expand(agooText t) {
|
26
|
+
t = agoo_text_prepend(t, prefix, sizeof(prefix) - 1);
|
27
|
+
return agoo_text_append(t, suffix, sizeof(suffix) - 1);
|
28
28
|
}
|
data/ext/agoo/sse.h
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
#ifndef AGOO_SSE_H
|
4
4
|
#define AGOO_SSE_H
|
5
5
|
|
6
|
-
struct
|
7
|
-
struct
|
6
|
+
struct _agooReq;
|
7
|
+
struct _agooText;
|
8
8
|
|
9
|
-
extern struct
|
10
|
-
extern struct
|
9
|
+
extern struct _agooText* agoo_sse_upgrade(struct _agooReq *req, struct _agooText *t);
|
10
|
+
extern struct _agooText* agoo_sse_expand(struct _agooText *t);
|
11
11
|
|
12
12
|
#endif // AGOO_SSE_H
|
data/ext/agoo/subject.c
CHANGED
@@ -7,9 +7,9 @@
|
|
7
7
|
#include "debug.h"
|
8
8
|
#include "subject.h"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
agooSubject
|
11
|
+
agoo_subject_create(const char *pattern, int plen) {
|
12
|
+
agooSubject subject = (agooSubject)malloc(sizeof(struct _agooSubject) - 7 + plen);
|
13
13
|
|
14
14
|
if (NULL != subject) {
|
15
15
|
DEBUG_ALLOC(mem_subject, subject);
|
@@ -21,13 +21,13 @@ subject_create(const char *pattern, int plen) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
void
|
24
|
-
|
24
|
+
agoo_subject_destroy(agooSubject subject) {
|
25
25
|
DEBUG_FREE(mem_subject, subject);
|
26
26
|
free(subject);
|
27
27
|
}
|
28
28
|
|
29
29
|
bool
|
30
|
-
|
30
|
+
agoo_subject_check(agooSubject subj, const char *subject) {
|
31
31
|
const char *pat = subj->pattern;
|
32
32
|
|
33
33
|
for (; '\0' != *pat && '\0' != *subject; subject++) {
|
data/ext/agoo/subject.h
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
#include <stdbool.h>
|
7
7
|
|
8
|
-
typedef struct
|
9
|
-
struct
|
8
|
+
typedef struct _agooSubject {
|
9
|
+
struct _agooSubject *next;
|
10
10
|
char pattern[8];
|
11
|
-
} *
|
11
|
+
} *agooSubject;
|
12
12
|
|
13
|
-
extern
|
14
|
-
extern void
|
15
|
-
extern bool
|
13
|
+
extern agooSubject agoo_subject_create(const char *pattern, int plen);
|
14
|
+
extern void agoo_subject_destroy(agooSubject subject);
|
15
|
+
extern bool agoo_subject_check(agooSubject subj, const char *subject);
|
16
16
|
|
17
17
|
#endif // AGOO_SUBJECT_H
|
data/ext/agoo/text.c
CHANGED
@@ -7,9 +7,9 @@
|
|
7
7
|
#include "debug.h"
|
8
8
|
#include "text.h"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
agooText
|
11
|
+
agoo_text_create(const char *str, int len) {
|
12
|
+
agooText t = (agooText)malloc(sizeof(struct _agooText) - AGOO_TEXT_MIN_SIZE + len + 1);
|
13
13
|
|
14
14
|
if (NULL != t) {
|
15
15
|
DEBUG_ALLOC(mem_text, t)
|
@@ -23,9 +23,9 @@ text_create(const char *str, int len) {
|
|
23
23
|
return t;
|
24
24
|
}
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
agooText
|
27
|
+
agoo_text_dup(agooText t0) {
|
28
|
+
agooText t = (agooText)malloc(sizeof(struct _agooText) - AGOO_TEXT_MIN_SIZE + t0->alen + 1);
|
29
29
|
|
30
30
|
if (NULL != t) {
|
31
31
|
DEBUG_ALLOC(mem_text, t)
|
@@ -38,9 +38,9 @@ text_dup(Text t0) {
|
|
38
38
|
return t;
|
39
39
|
}
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
agooText
|
42
|
+
agoo_text_allocate(int len) {
|
43
|
+
agooText t = (agooText)malloc(sizeof(struct _agooText) - AGOO_TEXT_MIN_SIZE + len + 1);
|
44
44
|
|
45
45
|
if (NULL != t) {
|
46
46
|
DEBUG_ALLOC(mem_text, t)
|
@@ -54,30 +54,30 @@ text_allocate(int len) {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
void
|
57
|
-
|
57
|
+
agoo_text_ref(agooText t) {
|
58
58
|
atomic_fetch_add(&t->ref_cnt, 1);
|
59
59
|
}
|
60
60
|
|
61
61
|
void
|
62
|
-
|
62
|
+
agoo_text_release(agooText t) {
|
63
63
|
if (1 >= atomic_fetch_sub(&t->ref_cnt, 1)) {
|
64
64
|
DEBUG_FREE(mem_text, t);
|
65
65
|
free(t);
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
69
|
-
|
70
|
-
|
69
|
+
agooText
|
70
|
+
agoo_text_append(agooText t, const char *s, int len) {
|
71
71
|
if (0 >= len) {
|
72
72
|
len = (int)strlen(s);
|
73
73
|
}
|
74
74
|
if (t->alen <= t->len + len) {
|
75
75
|
long new_len = t->alen + len + t->alen / 2;
|
76
|
-
size_t size = sizeof(struct
|
76
|
+
size_t size = sizeof(struct _agooText) - AGOO_TEXT_MIN_SIZE + new_len + 1;
|
77
77
|
#ifdef MEM_DEBUG
|
78
|
-
|
78
|
+
agooText t0 = t;
|
79
79
|
#endif
|
80
|
-
if (NULL == (t = (
|
80
|
+
if (NULL == (t = (agooText)realloc(t, size))) {
|
81
81
|
return NULL;
|
82
82
|
}
|
83
83
|
DEBUG_REALLOC(mem_text, t0, t);
|
@@ -90,19 +90,19 @@ text_append(Text t, const char *s, int len) {
|
|
90
90
|
return t;
|
91
91
|
}
|
92
92
|
|
93
|
-
|
94
|
-
|
93
|
+
agooText
|
94
|
+
agoo_text_prepend(agooText t, const char *s, int len) {
|
95
95
|
if (0 >= len) {
|
96
96
|
len = (int)strlen(s);
|
97
97
|
}
|
98
98
|
if (t->alen <= t->len + len) {
|
99
99
|
long new_len = t->alen + len + t->alen / 2;
|
100
|
-
size_t size = sizeof(struct
|
100
|
+
size_t size = sizeof(struct _agooText) - AGOO_TEXT_MIN_SIZE + new_len + 1;
|
101
101
|
#ifdef MEM_DEBUG
|
102
|
-
|
102
|
+
agooText t0 = t;
|
103
103
|
#endif
|
104
104
|
|
105
|
-
if (NULL == (t = (
|
105
|
+
if (NULL == (t = (agooText)realloc(t, size))) {
|
106
106
|
return NULL;
|
107
107
|
}
|
108
108
|
DEBUG_REALLOC(mem_text, t0, t);
|
data/ext/agoo/text.h
CHANGED
@@ -3,25 +3,26 @@
|
|
3
3
|
#ifndef AGOO_TEXT_H
|
4
4
|
#define AGOO_TEXT_H
|
5
5
|
|
6
|
-
#include <stdatomic.h>
|
7
6
|
#include <stdbool.h>
|
8
7
|
|
9
|
-
#
|
8
|
+
#include "atomic.h"
|
10
9
|
|
11
|
-
|
10
|
+
#define AGOO_TEXT_MIN_SIZE 8
|
11
|
+
|
12
|
+
typedef struct _agooText {
|
12
13
|
long len; // length of valid text
|
13
14
|
long alen; // size of allocated text
|
14
15
|
atomic_int ref_cnt;
|
15
16
|
bool bin;
|
16
|
-
char text[
|
17
|
-
} *
|
17
|
+
char text[AGOO_TEXT_MIN_SIZE];
|
18
|
+
} *agooText;
|
18
19
|
|
19
|
-
extern
|
20
|
-
extern
|
21
|
-
extern
|
22
|
-
extern void
|
23
|
-
extern void
|
24
|
-
extern
|
25
|
-
extern
|
20
|
+
extern agooText agoo_text_create(const char *str, int len);
|
21
|
+
extern agooText agoo_text_dup(agooText t);
|
22
|
+
extern agooText agoo_text_allocate(int len);
|
23
|
+
extern void agoo_text_ref(agooText t);
|
24
|
+
extern void agoo_text_release(agooText t);
|
25
|
+
extern agooText agoo_text_append(agooText t, const char *s, int len);
|
26
|
+
extern agooText agoo_text_prepend(agooText t, const char *s, int len);
|
26
27
|
|
27
|
-
#endif
|
28
|
+
#endif // AGOO_TEXT_H
|
data/ext/agoo/upgraded.c
CHANGED
@@ -11,14 +11,14 @@
|
|
11
11
|
#include "upgraded.h"
|
12
12
|
|
13
13
|
static void
|
14
|
-
destroy(
|
15
|
-
|
14
|
+
destroy(agooUpgraded up) {
|
15
|
+
agooSubject subject;
|
16
16
|
|
17
17
|
if (NULL != up->on_destroy) {
|
18
18
|
up->on_destroy(up);
|
19
19
|
}
|
20
20
|
if (NULL == up->prev) {
|
21
|
-
|
21
|
+
agoo_server.up_list = up->next;
|
22
22
|
if (NULL != up->next) {
|
23
23
|
up->next->prev = NULL;
|
24
24
|
}
|
@@ -30,40 +30,40 @@ destroy(Upgraded up) {
|
|
30
30
|
}
|
31
31
|
while (NULL != (subject = up->subjects)) {
|
32
32
|
up->subjects = up->subjects->next;
|
33
|
-
|
33
|
+
agoo_subject_destroy(subject);
|
34
34
|
}
|
35
35
|
DEBUG_FREE(mem_upgraded, up);
|
36
36
|
free(up);
|
37
37
|
}
|
38
38
|
|
39
39
|
void
|
40
|
-
|
41
|
-
pthread_mutex_lock(&
|
40
|
+
agoo_upgraded_release(agooUpgraded up) {
|
41
|
+
pthread_mutex_lock(&agoo_server.up_lock);
|
42
42
|
if (atomic_fetch_sub(&up->ref_cnt, 1) <= 1) {
|
43
43
|
destroy(up);
|
44
44
|
}
|
45
|
-
pthread_mutex_unlock(&
|
45
|
+
pthread_mutex_unlock(&agoo_server.up_lock);
|
46
46
|
}
|
47
47
|
|
48
48
|
void
|
49
|
-
|
50
|
-
pthread_mutex_lock(&
|
49
|
+
agoo_upgraded_release_con(agooUpgraded up) {
|
50
|
+
pthread_mutex_lock(&agoo_server.up_lock);
|
51
51
|
up->con = NULL;
|
52
52
|
if (atomic_fetch_sub(&up->ref_cnt, 1) <= 1) {
|
53
53
|
destroy(up);
|
54
54
|
}
|
55
|
-
pthread_mutex_unlock(&
|
55
|
+
pthread_mutex_unlock(&agoo_server.up_lock);
|
56
56
|
}
|
57
57
|
|
58
58
|
// Called from the con_loop thread, no need to lock, this steals the subject
|
59
59
|
// so the pub subject should set to NULL
|
60
60
|
void
|
61
|
-
|
62
|
-
|
61
|
+
agoo_upgraded_add_subject(agooUpgraded up, agooSubject subject) {
|
62
|
+
agooSubject s;
|
63
63
|
|
64
64
|
for (s = up->subjects; NULL != s; s = s->next) {
|
65
65
|
if (0 == strcmp(subject->pattern, s->pattern)) {
|
66
|
-
|
66
|
+
agoo_subject_destroy(subject);
|
67
67
|
return;
|
68
68
|
}
|
69
69
|
}
|
@@ -72,15 +72,15 @@ upgraded_add_subject(Upgraded up, Subject subject) {
|
|
72
72
|
}
|
73
73
|
|
74
74
|
void
|
75
|
-
|
75
|
+
agoo_upgraded_del_subject(agooUpgraded up, agooSubject subject) {
|
76
76
|
if (NULL == subject) {
|
77
77
|
while (NULL != (subject = up->subjects)) {
|
78
78
|
up->subjects = up->subjects->next;
|
79
|
-
|
79
|
+
agoo_subject_destroy(subject);
|
80
80
|
}
|
81
81
|
} else {
|
82
|
-
|
83
|
-
|
82
|
+
agooSubject s;
|
83
|
+
agooSubject prev = NULL;
|
84
84
|
|
85
85
|
for (s = up->subjects; NULL != s; s = s->next) {
|
86
86
|
if (0 == strcmp(subject->pattern, s->pattern)) {
|
@@ -89,7 +89,7 @@ upgraded_del_subject(Upgraded up, Subject subject) {
|
|
89
89
|
} else {
|
90
90
|
prev->next = s->next;
|
91
91
|
}
|
92
|
-
|
92
|
+
agoo_subject_destroy(s);
|
93
93
|
break;
|
94
94
|
}
|
95
95
|
prev = s;
|
@@ -98,11 +98,11 @@ upgraded_del_subject(Upgraded up, Subject subject) {
|
|
98
98
|
}
|
99
99
|
|
100
100
|
bool
|
101
|
-
|
102
|
-
|
101
|
+
agoo_upgraded_match(agooUpgraded up, const char *subject) {
|
102
|
+
agooSubject s;
|
103
103
|
|
104
104
|
for (s = up->subjects; NULL != s; s = s->next) {
|
105
|
-
if (
|
105
|
+
if (agoo_subject_check(s, subject)) {
|
106
106
|
return true;
|
107
107
|
}
|
108
108
|
}
|
@@ -110,15 +110,15 @@ upgraded_match(Upgraded up, const char *subject) {
|
|
110
110
|
}
|
111
111
|
|
112
112
|
void
|
113
|
-
|
113
|
+
agoo_upgraded_ref(agooUpgraded up) {
|
114
114
|
atomic_fetch_add(&up->ref_cnt, 1);
|
115
115
|
}
|
116
116
|
|
117
117
|
bool
|
118
|
-
|
119
|
-
|
118
|
+
agoo_upgraded_write(agooUpgraded up, const char *message, size_t mlen, bool bin, bool inc_ref) {
|
119
|
+
agooPub p;
|
120
120
|
|
121
|
-
if (0 <
|
121
|
+
if (0 < agoo_server.max_push_pending && agoo_server.max_push_pending <= (long)atomic_load(&up->pending)) {
|
122
122
|
atomic_fetch_sub(&up->ref_cnt, 1);
|
123
123
|
// Too many pending messages.
|
124
124
|
return false;
|
@@ -126,57 +126,58 @@ upgraded_write(Upgraded up, const char *message, size_t mlen, bool bin, bool inc
|
|
126
126
|
if (inc_ref) {
|
127
127
|
atomic_fetch_add(&up->ref_cnt, 1);
|
128
128
|
}
|
129
|
-
p =
|
129
|
+
p = agoo_pub_write(up, message, mlen, bin);
|
130
130
|
atomic_fetch_add(&up->pending, 1);
|
131
|
-
|
131
|
+
agoo_server_publish(p);
|
132
132
|
|
133
133
|
return true;
|
134
134
|
}
|
135
135
|
|
136
136
|
void
|
137
|
-
|
137
|
+
agoo_upgraded_subscribe(agooUpgraded up, const char *subject, int slen, bool inc_ref) {
|
138
138
|
if (inc_ref) {
|
139
139
|
atomic_fetch_add(&up->ref_cnt, 1);
|
140
140
|
}
|
141
141
|
atomic_fetch_add(&up->pending, 1);
|
142
|
-
|
142
|
+
agoo_server_publish(agoo_pub_subscribe(up, subject, slen));
|
143
143
|
}
|
144
144
|
|
145
145
|
void
|
146
|
-
|
146
|
+
agoo_upgraded_unsubscribe(agooUpgraded up, const char *subject, int slen, bool inc_ref) {
|
147
147
|
if (inc_ref) {
|
148
148
|
atomic_fetch_add(&up->ref_cnt, 1);
|
149
149
|
}
|
150
150
|
atomic_fetch_add(&up->pending, 1);
|
151
|
-
|
151
|
+
agoo_server_publish(agoo_pub_unsubscribe(up, subject, slen));
|
152
152
|
}
|
153
153
|
|
154
154
|
void
|
155
|
-
|
155
|
+
agoo_upgraded_close(agooUpgraded up, bool inc_ref) {
|
156
156
|
if (inc_ref) {
|
157
157
|
atomic_fetch_add(&up->ref_cnt, 1);
|
158
158
|
}
|
159
159
|
atomic_fetch_add(&up->pending, 1);
|
160
|
-
|
160
|
+
agoo_server_publish(agoo_pub_close(up));
|
161
161
|
}
|
162
162
|
|
163
163
|
int
|
164
|
-
|
165
|
-
return atomic_load(&up->pending);
|
164
|
+
agoo_upgraded_pending(agooUpgraded up) {
|
165
|
+
return (int)(long)atomic_load(&up->pending);
|
166
166
|
}
|
167
167
|
|
168
|
-
|
169
|
-
|
170
|
-
|
168
|
+
agooUpgraded
|
169
|
+
agoo_upgraded_create(agooCon c, void * ctx, void *env) {
|
170
|
+
agooUpgraded up = (agooUpgraded)malloc(sizeof(struct _agooUpgraded));
|
171
171
|
|
172
172
|
if (NULL != up) {
|
173
173
|
DEBUG_ALLOC(mem_upgraded, up);
|
174
|
-
memset(up, 0, sizeof(struct
|
174
|
+
memset(up, 0, sizeof(struct _agooUpgraded));
|
175
175
|
up->con = c;
|
176
176
|
up->ctx = ctx;
|
177
177
|
up->env = env;
|
178
178
|
atomic_init(&up->pending, 0);
|
179
|
-
atomic_init(&up->ref_cnt,
|
179
|
+
atomic_init(&up->ref_cnt, 0);
|
180
|
+
atomic_store(&up->ref_cnt, 1); // start with 1 for the Con reference
|
180
181
|
}
|
181
182
|
return up;
|
182
183
|
}
|
data/ext/agoo/upgraded.h
CHANGED
@@ -4,48 +4,49 @@
|
|
4
4
|
#define AGOO_UPGRADED_H
|
5
5
|
|
6
6
|
#include <pthread.h>
|
7
|
-
#include <stdatomic.h>
|
8
7
|
#include <stdint.h>
|
9
8
|
#include <stdbool.h>
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
struct
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
void
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
bool
|
29
|
-
bool
|
30
|
-
bool
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
extern
|
37
|
-
|
38
|
-
|
39
|
-
extern void
|
40
|
-
|
41
|
-
extern void
|
42
|
-
|
43
|
-
extern
|
44
|
-
|
45
|
-
extern bool
|
46
|
-
|
47
|
-
extern
|
48
|
-
extern void
|
49
|
-
extern
|
10
|
+
#include "atomic.h"
|
11
|
+
|
12
|
+
struct _agooCon;
|
13
|
+
struct _agooSubject;
|
14
|
+
|
15
|
+
typedef struct _agooUpgraded {
|
16
|
+
struct _agooUpgraded *next;
|
17
|
+
struct _agooUpgraded *prev;
|
18
|
+
struct _agooCon *con;
|
19
|
+
atomic_int pending;
|
20
|
+
atomic_int ref_cnt;
|
21
|
+
struct _agooSubject *subjects;
|
22
|
+
|
23
|
+
void *ctx;
|
24
|
+
void *wrap;
|
25
|
+
void *env;
|
26
|
+
|
27
|
+
bool on_empty;
|
28
|
+
bool on_close;
|
29
|
+
bool on_shut;
|
30
|
+
bool on_msg;
|
31
|
+
bool on_error;
|
32
|
+
void (*on_destroy)(struct _agooUpgraded *up);
|
33
|
+
} *agooUpgraded;
|
34
|
+
|
35
|
+
extern agooUpgraded agoo_upgraded_create(struct _agooCon *c, void * ctx, void *env);
|
36
|
+
|
37
|
+
extern void agoo_upgraded_release(agooUpgraded up);
|
38
|
+
extern void agoo_upgraded_release_con(agooUpgraded up);
|
39
|
+
|
40
|
+
extern void agoo_upgraded_ref(agooUpgraded up);
|
41
|
+
|
42
|
+
extern void agoo_upgraded_add_subject(agooUpgraded up, struct _agooSubject *subject);
|
43
|
+
extern void agoo_upgraded_del_subject(agooUpgraded up, struct _agooSubject *subject);
|
44
|
+
extern bool agoo_upgraded_match(agooUpgraded up, const char *subject);
|
45
|
+
|
46
|
+
extern bool agoo_upgraded_write(agooUpgraded up, const char *message, size_t mlen, bool bin, bool inc_ref);
|
47
|
+
extern void agoo_upgraded_subscribe(agooUpgraded up, const char *subject, int slen, bool inc_ref);
|
48
|
+
extern void agoo_upgraded_unsubscribe(agooUpgraded up, const char *subject, int slen, bool inc_ref);
|
49
|
+
extern void agoo_upgraded_close(agooUpgraded up, bool inc_ref);
|
50
|
+
extern int agoo_upgraded_pending(agooUpgraded up);
|
50
51
|
|
51
52
|
#endif // AGOO_UPGRADED_H
|