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.

Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +1 -1
  4. data/ext/agoo/agoo.c +4 -3
  5. data/ext/agoo/atomic.h +120 -0
  6. data/ext/agoo/bind.c +52 -52
  7. data/ext/agoo/bind.h +13 -13
  8. data/ext/agoo/con.c +499 -481
  9. data/ext/agoo/con.h +47 -39
  10. data/ext/agoo/debug.c +42 -42
  11. data/ext/agoo/debug.h +1 -1
  12. data/ext/agoo/doc.c +17 -17
  13. data/ext/agoo/doc.h +12 -12
  14. data/ext/agoo/err.c +18 -18
  15. data/ext/agoo/err.h +27 -27
  16. data/ext/agoo/error_stream.c +9 -9
  17. data/ext/agoo/extconf.rb +3 -0
  18. data/ext/agoo/gqlintro.c +43 -43
  19. data/ext/agoo/gqlintro.h +1 -1
  20. data/ext/agoo/gqlvalue.c +131 -131
  21. data/ext/agoo/gqlvalue.h +32 -32
  22. data/ext/agoo/graphql.c +158 -158
  23. data/ext/agoo/graphql.h +34 -33
  24. data/ext/agoo/hook.c +15 -14
  25. data/ext/agoo/hook.h +18 -14
  26. data/ext/agoo/http.c +14 -14
  27. data/ext/agoo/http.h +4 -4
  28. data/ext/agoo/kinds.h +5 -5
  29. data/ext/agoo/log.c +232 -224
  30. data/ext/agoo/log.h +93 -93
  31. data/ext/agoo/method.h +17 -17
  32. data/ext/agoo/page.c +88 -86
  33. data/ext/agoo/page.h +21 -21
  34. data/ext/agoo/pub.c +36 -36
  35. data/ext/agoo/pub.h +23 -23
  36. data/ext/agoo/queue.c +37 -38
  37. data/ext/agoo/queue.h +20 -19
  38. data/ext/agoo/rack_logger.c +13 -13
  39. data/ext/agoo/ready.c +357 -0
  40. data/ext/agoo/ready.h +41 -0
  41. data/ext/agoo/req.c +11 -11
  42. data/ext/agoo/req.h +30 -31
  43. data/ext/agoo/request.c +46 -46
  44. data/ext/agoo/request.h +2 -2
  45. data/ext/agoo/res.c +40 -18
  46. data/ext/agoo/res.h +14 -14
  47. data/ext/agoo/response.c +6 -6
  48. data/ext/agoo/response.h +9 -9
  49. data/ext/agoo/rhook.c +3 -3
  50. data/ext/agoo/rhook.h +1 -1
  51. data/ext/agoo/rlog.c +47 -42
  52. data/ext/agoo/rlog.h +0 -1
  53. data/ext/agoo/rresponse.c +33 -33
  54. data/ext/agoo/rresponse.h +1 -1
  55. data/ext/agoo/rserver.c +184 -175
  56. data/ext/agoo/rserver.h +2 -2
  57. data/ext/agoo/rupgraded.c +41 -41
  58. data/ext/agoo/rupgraded.h +3 -3
  59. data/ext/agoo/sdl.c +80 -80
  60. data/ext/agoo/sdl.h +1 -1
  61. data/ext/agoo/seg.h +2 -2
  62. data/ext/agoo/server.c +143 -117
  63. data/ext/agoo/server.h +43 -42
  64. data/ext/agoo/sse.c +7 -7
  65. data/ext/agoo/sse.h +4 -4
  66. data/ext/agoo/subject.c +5 -5
  67. data/ext/agoo/subject.h +6 -6
  68. data/ext/agoo/text.c +21 -21
  69. data/ext/agoo/text.h +14 -13
  70. data/ext/agoo/upgraded.c +41 -40
  71. data/ext/agoo/upgraded.h +41 -40
  72. data/ext/agoo/websocket.c +42 -42
  73. data/ext/agoo/websocket.h +16 -16
  74. data/lib/agoo/version.rb +1 -1
  75. data/test/static_test.rb +2 -0
  76. metadata +5 -5
  77. data/ext/agoo/log_queue.h +0 -30
  78. data/ext/agoo/sub.c +0 -111
  79. data/ext/agoo/sub.h +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 409a4fe687d9ff75a67d4b25f559b5baa9df782d828bfeb1645daf696ba30035
4
- data.tar.gz: a57f3d142cdee7c3ac6fc9d73fd05e2b1e5e4c90a1a2f276e4af0f69764f232b
3
+ metadata.gz: cad69f3ff26f2495acc27644889572dceafba42fffe0bf15b27f3ed711f764a6
4
+ data.tar.gz: c47ac0aca4a90eebb507bf64d3da2508bc9ce1e608d281f351ea1745ad0cb745
5
5
  SHA512:
6
- metadata.gz: e4f662d43b893105689f50df6a8942ec2e86e82bec8534cff159e5a5b634a5075c1a80283c474b855c41bdff208ed1f3d605ba5b98a0591bd385202a751ac884
7
- data.tar.gz: 2fd33f0f3021820efc68a4b073526fa584ba4792d10cd25806a81b11131ffcd13d35863dc1c58a11a203f03e4d10e6943dedaf6b9f9adfbfacce97c46ea4e918
6
+ metadata.gz: cdd0fb689b6e1afa3b65c4cbb5b2c7151b7d76202aa0c58a57d30a8bf2e1d3cdb026f15a731745eab042f762639ed29094c065354c942cf4c2b20cd99c11d53b
7
+ data.tar.gz: 3c82c32e1e52ccd0da66b47c94365d236c27ea4c7be7812fb9a5d8a91d880c9d6838a4734e1ddf00f77ed3fd8de3a3583f83bdf4e02c235483c27da27d0573c4
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 2.5.6 - 2018-11-26
4
+
5
+ Even more cleanup and minor performance tweak.
6
+
7
+ - Changed the use of __ and _X in C code.
8
+
9
+ - Resuse of some memory for responses.
10
+
11
+ - Compile option to use epoll instead of poll. (its slower)
12
+
3
13
  ### 2.5.5 - 2018-11-12
4
14
 
5
15
  More optimizations and some cleanup.
data/README.md CHANGED
@@ -38,7 +38,7 @@ gem install agoo
38
38
 
39
39
  Agoo is Japanese for a type of flying fish. This gem flies. It is a high
40
40
  performance HTTP server that serves static resource at hundreds of thousands
41
- of fetchs per second. A a simple hello world Ruby handler at over 100,000
41
+ of fetches per second. A simple hello world Ruby handler at over 100,000
42
42
  requests per second on a desktop computer. That places Agoo at about 85 times
43
43
  faster than Sinatra and 1000 times faster than Rails. In both cases the
44
44
  latency was two orders of magnitude lower or more. Checkout the
@@ -7,6 +7,7 @@
7
7
 
8
8
  #include "debug.h"
9
9
  #include "error_stream.h"
10
+ #include "log.h"
10
11
  #include "pub.h"
11
12
  #include "rack_logger.h"
12
13
  #include "request.h"
@@ -20,7 +21,7 @@
20
21
  void
21
22
  agoo_shutdown() {
22
23
  rserver_shutdown(Qnil);
23
- log_close();
24
+ agoo_log_close();
24
25
  }
25
26
 
26
27
  /* Document-method: shutdown
@@ -49,7 +50,7 @@ ragoo_publish(VALUE self, VALUE subject, VALUE message) {
49
50
  const char *subj = extract_subject(subject, &slen);
50
51
 
51
52
  rb_check_type(message, T_STRING);
52
- server_publish(pub_publish(subj, slen, StringValuePtr(message), (int)RSTRING_LEN(message)));
53
+ agoo_server_publish(agoo_pub_publish(subj, slen, StringValuePtr(message), (int)RSTRING_LEN(message)));
53
54
 
54
55
  return Qnil;
55
56
  }
@@ -66,7 +67,7 @@ static VALUE
66
67
  ragoo_unsubscribe(VALUE self, VALUE subject) {
67
68
  rb_check_type(subject, T_STRING);
68
69
 
69
- server_publish(pub_unsubscribe(NULL, StringValuePtr(subject), (int)RSTRING_LEN(subject)));
70
+ agoo_server_publish(agoo_pub_unsubscribe(NULL, StringValuePtr(subject), (int)RSTRING_LEN(subject)));
70
71
 
71
72
  return Qnil;
72
73
  }
@@ -0,0 +1,120 @@
1
+ // Copyright (c) 2018, Peter Ohler, All rights reserved.
2
+
3
+ #ifndef AGOO_ATOMIC_H
4
+ #define AGOO_ATOMIC_H
5
+
6
+ #if HAVE_STDATOMIC_H
7
+
8
+ #include <stdatomic.h>
9
+
10
+ #define AGOO_ATOMIC_INT_INIT(v) (v)
11
+
12
+ static inline void
13
+ agoo_atomic_flag_init(atomic_flag *flagp) {
14
+ atomic_flag_clear(flagp);
15
+ }
16
+
17
+ #else
18
+
19
+ // This is a poor attempt to implement the stdatomic calls needed for this
20
+ // project. No attempt was made to make it either fast or memory efficient. It
21
+ // works for older compilers and it turns out the overall impact on
22
+ // performance is small.
23
+
24
+ #include <stdbool.h>
25
+ #include <pthread.h>
26
+ #include <stdio.h>
27
+ #include <string.h>
28
+
29
+ typedef struct _agooAtom {
30
+ volatile void *value;
31
+ pthread_mutex_t lock;
32
+ } *agooAtom;
33
+
34
+ #define _Atomic(T) struct _agooAtom
35
+
36
+ #define AGOO_ATOMIC_INT_INIT(v) { .value = (v), .lock = PTHREAD_MUTEX_INITIALIZER }
37
+ #define ATOMIC_FLAG_INIT { .value = NULL, .lock = PTHREAD_MUTEX_INITIALIZER }
38
+
39
+ typedef struct _agooAtom atomic_flag;
40
+ typedef struct _agooAtom atomic_int;
41
+
42
+ static inline void
43
+ agoo_atomic_flag_init(atomic_flag *flagp) {
44
+ flagp->value = NULL;
45
+ pthread_mutex_init(&flagp->lock, NULL);
46
+ }
47
+
48
+ static inline void
49
+ atomic_init(agooAtom a, void *value) {
50
+ a->value = value;
51
+ pthread_mutex_init(&a->lock, NULL);
52
+ }
53
+
54
+ #define atomic_store(a, v) _atomic_store((a), (void*)(v))
55
+
56
+ static inline void
57
+ _atomic_store(agooAtom a, void *value) {
58
+ pthread_mutex_lock(&a->lock);
59
+ a->value = value;
60
+ pthread_mutex_unlock(&a->lock);
61
+ }
62
+
63
+ static inline void*
64
+ atomic_load(agooAtom a) {
65
+ void *value;
66
+
67
+ pthread_mutex_lock(&a->lock);
68
+ value = (void*)a->value;
69
+ pthread_mutex_unlock(&a->lock);
70
+
71
+ return value;
72
+ }
73
+
74
+ static inline int
75
+ atomic_fetch_add(agooAtom a, int delta) {
76
+ int before;
77
+
78
+ pthread_mutex_lock(&a->lock);
79
+ before = (int)(long)a->value;
80
+ a->value = (void*)(long)(before + delta);
81
+ pthread_mutex_unlock(&a->lock);
82
+
83
+ return before;
84
+ }
85
+
86
+ static inline int
87
+ atomic_fetch_sub(agooAtom a, int delta) {
88
+ int before;
89
+
90
+ pthread_mutex_lock(&a->lock);
91
+ before = (int)(long)a->value;
92
+ a->value = (void*)(long)(before - delta);
93
+ pthread_mutex_unlock(&a->lock);
94
+
95
+ return before;
96
+ }
97
+
98
+ static inline void
99
+ atomic_flag_clear(agooAtom a) {
100
+ pthread_mutex_lock(&a->lock);
101
+ a->value = NULL;
102
+ pthread_mutex_unlock(&a->lock);
103
+ }
104
+
105
+ static inline bool
106
+ atomic_flag_test_and_set(agooAtom a) {
107
+ volatile void *prev;
108
+
109
+ pthread_mutex_lock(&a->lock);
110
+ if (NULL == (prev = a->value)) {
111
+ a->value = (void*)"true";
112
+ }
113
+ pthread_mutex_unlock(&a->lock);
114
+
115
+ return (NULL != prev);
116
+ }
117
+
118
+ #endif
119
+
120
+ #endif // AGOO_ATOMIC_H
@@ -13,21 +13,21 @@
13
13
  #include "debug.h"
14
14
  #include "log.h"
15
15
 
16
- Bind
17
- bind_port(Err err, int port) {
18
- Bind b = (Bind)malloc(sizeof(struct _Bind));
16
+ agooBind
17
+ agoo_bind_port(agooErr err, int port) {
18
+ agooBind b = (agooBind)malloc(sizeof(struct _agooBind));
19
19
 
20
20
  if (NULL != b) {
21
21
  char id[1024];
22
22
 
23
23
  DEBUG_ALLOC(mem_bind, b);
24
- memset(b, 0, sizeof(struct _Bind));
24
+ memset(b, 0, sizeof(struct _agooBind));
25
25
  b->port = port;
26
26
  b->family = AF_INET;
27
27
  snprintf(id, sizeof(id) - 1, "http://:%d", port);
28
28
  strcpy(b->scheme, "http");
29
29
  b->id = strdup(id);
30
- b->kind = CON_HTTP;
30
+ b->kind = AGOO_CON_HTTP;
31
31
  b->read = NULL;
32
32
  b->write = NULL;
33
33
  b->events = NULL;
@@ -35,17 +35,17 @@ bind_port(Err err, int port) {
35
35
  return b;
36
36
  }
37
37
 
38
- static Bind
39
- url_tcp(Err err, const char *url, const char *scheme) {
38
+ static agooBind
39
+ url_tcp(agooErr err, const char *url, const char *scheme) {
40
40
  char *colon = index(url, ':');
41
41
  struct in_addr addr = { .s_addr = 0 };
42
42
  int port;
43
- Bind b;
43
+ agooBind b;
44
44
 
45
45
  if (NULL == colon) {
46
46
  port = 80;
47
47
  } else if (15 < colon - url) {
48
- err_set(err, ERR_ARG, "%s bind address is not valid, too long. (%s)", scheme, url);
48
+ agoo_err_set(err, AGOO_ERR_ARG, "%s bind address is not valid, too long. (%s)", scheme, url);
49
49
  return NULL;
50
50
  } else if (':' == *url) {
51
51
  port = atoi(colon + 1);
@@ -55,16 +55,16 @@ url_tcp(Err err, const char *url, const char *scheme) {
55
55
  strncpy(buf, url, colon - url);
56
56
  buf[colon - url] = '\0';
57
57
  if (0 == inet_aton(buf, &addr)) {
58
- err_set(err, ERR_ARG, "%s bind address is not valid. (%s)", scheme, url);
58
+ agoo_err_set(err, AGOO_ERR_ARG, "%s bind address is not valid. (%s)", scheme, url);
59
59
  return NULL;
60
60
  }
61
61
  port = atoi(colon + 1);
62
62
  }
63
- if (NULL != (b = (Bind)malloc(sizeof(struct _Bind)))) {
63
+ if (NULL != (b = (agooBind)malloc(sizeof(struct _agooBind)))) {
64
64
  char id[64];
65
65
 
66
66
  DEBUG_ALLOC(mem_bind, b);
67
- memset(b, 0, sizeof(struct _Bind));
67
+ memset(b, 0, sizeof(struct _agooBind));
68
68
 
69
69
  b->port = port;
70
70
  b->addr4 = addr;
@@ -73,25 +73,25 @@ url_tcp(Err err, const char *url, const char *scheme) {
73
73
  b->id = strdup(id);
74
74
  strncpy(b->scheme, scheme, sizeof(b->scheme));
75
75
  b->scheme[sizeof(b->scheme) - 1] = '\0';
76
- b->kind = CON_HTTP;
76
+ b->kind = AGOO_CON_HTTP;
77
77
  b->read = NULL;
78
78
  b->write = NULL;
79
79
  b->events = NULL;
80
80
 
81
81
  return b;
82
82
  }
83
- err_set(err, ERR_MEMORY, "Failed to allocate memory for a Bind.");
83
+ agoo_err_set(err, AGOO_ERR_MEMORY, "Failed to allocate memory for a Bind.");
84
84
 
85
85
  return b;
86
86
  }
87
87
 
88
- static Bind
89
- url_tcp6(Err err, const char *url, const char *scheme) {
88
+ static agooBind
89
+ url_tcp6(agooErr err, const char *url, const char *scheme) {
90
90
  struct in6_addr addr;
91
91
  char *end = index(url, ']');
92
92
  int port = 80;
93
93
  char buf[256];
94
- Bind b;
94
+ agooBind b;
95
95
 
96
96
  if (':' == *(end + 1)) {
97
97
  port = atoi(end + 2);
@@ -100,14 +100,14 @@ url_tcp6(Err err, const char *url, const char *scheme) {
100
100
  buf[end - url - 1] = '\0';
101
101
  memset(&addr, 0, sizeof(addr));
102
102
  if (0 == inet_pton(AF_INET6, buf, &addr)) {
103
- err_set(err, ERR_ARG, "%s bind address is not valid. (%s)", scheme, url);
103
+ agoo_err_set(err, AGOO_ERR_ARG, "%s bind address is not valid. (%s)", scheme, url);
104
104
  return NULL;
105
105
  }
106
- if (NULL != (b = (Bind)malloc(sizeof(struct _Bind)))) {
106
+ if (NULL != (b = (agooBind)malloc(sizeof(struct _agooBind)))) {
107
107
  char str[INET6_ADDRSTRLEN + 1];
108
108
 
109
109
  DEBUG_ALLOC(mem_bind, b);
110
- memset(b, 0, sizeof(struct _Bind));
110
+ memset(b, 0, sizeof(struct _agooBind));
111
111
 
112
112
  b->port = port;
113
113
  b->addr6 = addr;
@@ -116,56 +116,56 @@ url_tcp6(Err err, const char *url, const char *scheme) {
116
116
  b->id = strdup(buf);
117
117
  strncpy(b->scheme, scheme, sizeof(b->scheme));
118
118
  b->scheme[sizeof(b->scheme) - 1] = '\0';
119
- b->kind = CON_HTTP;
119
+ b->kind = AGOO_CON_HTTP;
120
120
  b->read = NULL;
121
121
  b->write = NULL;
122
122
  b->events = NULL;
123
123
 
124
124
  return b;
125
125
  }
126
- err_set(err, ERR_MEMORY, "Failed to allocate memory for a Bind.");
126
+ agoo_err_set(err, AGOO_ERR_MEMORY, "Failed to allocate memory for a Bind.");
127
127
 
128
128
  return b;
129
129
  }
130
130
 
131
- static Bind
132
- url_named(Err err, const char *url) {
131
+ static agooBind
132
+ url_named(agooErr err, const char *url) {
133
133
  if ('\0' == *url) {
134
- err_set(err, ERR_ARG, "Named Unix sockets names must not be empty.");
134
+ agoo_err_set(err, AGOO_ERR_ARG, "Named Unix sockets names must not be empty.");
135
135
  return NULL;
136
136
  } else {
137
- Bind b = (Bind)malloc(sizeof(struct _Bind));
137
+ agooBind b = (agooBind)malloc(sizeof(struct _agooBind));
138
138
 
139
139
  if (NULL != b) {
140
140
  const char *fmt = "unix://%s";
141
141
  char id[1024];
142
142
 
143
143
  DEBUG_ALLOC(mem_bind, b);
144
- memset(b, 0, sizeof(struct _Bind));
144
+ memset(b, 0, sizeof(struct _agooBind));
145
145
  b->name = strdup(url);
146
146
  snprintf(id, sizeof(id) - 1, fmt, url);
147
147
  b->id = strdup(id);
148
148
  strcpy(b->scheme, "unix");
149
- b->kind = CON_HTTP;
149
+ b->kind = AGOO_CON_HTTP;
150
150
  b->read = NULL;
151
151
  b->write = NULL;
152
152
  b->events = NULL;
153
153
  }
154
154
  return b;
155
155
  }
156
- err_set(err, ERR_MEMORY, "Failed to allocate memory for a Bind.");
156
+ agoo_err_set(err, AGOO_ERR_MEMORY, "Failed to allocate memory for a Bind.");
157
157
 
158
158
  return NULL;
159
159
  }
160
160
 
161
- static Bind
162
- url_ssl(Err err, const char *url) {
161
+ static agooBind
162
+ url_ssl(agooErr err, const char *url) {
163
163
  // TBD
164
164
  return NULL;
165
165
  }
166
166
 
167
- Bind
168
- bind_url(Err err, const char *url) {
167
+ agooBind
168
+ agoo_bind_url(agooErr err, const char *url) {
169
169
  if (0 == strncmp("tcp://", url, 6)) {
170
170
  if ('[' == url[6]) {
171
171
  return url_tcp6(err, url + 6, "tcp");
@@ -207,7 +207,7 @@ bind_url(Err err, const char *url) {
207
207
  }
208
208
 
209
209
  void
210
- bind_destroy(Bind b) {
210
+ agoo_bind_destroy(agooBind b) {
211
211
  DEBUG_FREE(mem_bind, b);
212
212
  free(b->id);
213
213
  free(b->name);
@@ -218,7 +218,7 @@ bind_destroy(Bind b) {
218
218
  }
219
219
 
220
220
  static int
221
- usual_listen(Err err, Bind b) {
221
+ usual_listen(agooErr err, agooBind b) {
222
222
  int optval = 1;
223
223
  int domain = PF_INET;
224
224
 
@@ -226,9 +226,9 @@ usual_listen(Err err, Bind b) {
226
226
  domain = PF_INET6;
227
227
  }
228
228
  if (0 >= (b->fd = socket(domain, SOCK_STREAM, IPPROTO_TCP))) {
229
- log_cat(&error_cat, "Server failed to open server socket on port %d. %s.", b->port, strerror(errno));
229
+ agoo_log_cat(&agoo_error_cat, "Server failed to open server socket on port %d. %s.", b->port, strerror(errno));
230
230
 
231
- return err_set(err, errno, "Server failed to open server socket. %s.", strerror(errno));
231
+ return agoo_err_set(err, errno, "Server failed to open server socket. %s.", strerror(errno));
232
232
  }
233
233
  #ifdef OSX_OS
234
234
  setsockopt(b->fd, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval));
@@ -244,9 +244,9 @@ usual_listen(Err err, Bind b) {
244
244
  addr.sin6_addr = b->addr6;
245
245
  addr.sin6_port = htons(b->port);
246
246
  if (0 > bind(b->fd, (struct sockaddr*)&addr, sizeof(addr))) {
247
- log_cat(&error_cat, "Server failed to bind server socket. %s.", strerror(errno));
247
+ agoo_log_cat(&agoo_error_cat, "Server failed to bind server socket. %s.", strerror(errno));
248
248
 
249
- return err_set(err, errno, "Server failed to bind server socket. %s.", strerror(errno));
249
+ return agoo_err_set(err, errno, "Server failed to bind server socket. %s.", strerror(errno));
250
250
  }
251
251
  } else {
252
252
  struct sockaddr_in addr;
@@ -256,47 +256,47 @@ usual_listen(Err err, Bind b) {
256
256
  addr.sin_addr = b->addr4;
257
257
  addr.sin_port = htons(b->port);
258
258
  if (0 > bind(b->fd, (struct sockaddr*)&addr, sizeof(addr))) {
259
- log_cat(&error_cat, "Server failed to bind server socket. %s.", strerror(errno));
259
+ agoo_log_cat(&agoo_error_cat, "Server failed to bind server socket. %s.", strerror(errno));
260
260
 
261
- return err_set(err, errno, "Server failed to bind server socket. %s.", strerror(errno));
261
+ return agoo_err_set(err, errno, "Server failed to bind server socket. %s.", strerror(errno));
262
262
  }
263
263
  }
264
264
  listen(b->fd, 1000);
265
265
 
266
- return ERR_OK;
266
+ return AGOO_ERR_OK;
267
267
  }
268
268
 
269
269
  static int
270
- named_listen(Err err, Bind b) {
270
+ named_listen(agooErr err, agooBind b) {
271
271
  struct sockaddr_un addr;
272
272
 
273
273
  remove(b->name);
274
274
  if (0 >= (b->fd = socket(AF_UNIX, SOCK_STREAM, 0))) {
275
- log_cat(&error_cat, "Server failed to open server socket on %s. %s.", b->name, strerror(errno));
275
+ agoo_log_cat(&agoo_error_cat, "Server failed to open server socket on %s. %s.", b->name, strerror(errno));
276
276
 
277
- return err_set(err, errno, "Server failed to open server socket on %s. %s.", b->name, strerror(errno));
277
+ return agoo_err_set(err, errno, "Server failed to open server socket on %s. %s.", b->name, strerror(errno));
278
278
  }
279
279
  memset(&addr, 0, sizeof(addr));
280
280
  addr.sun_family = AF_UNIX;
281
281
  strcpy(addr.sun_path, b->name);
282
282
  if (0 > bind(b->fd, (struct sockaddr*)&addr, sizeof(addr))) {
283
- log_cat(&error_cat, "Server failed to bind server socket. %s.", strerror(errno));
283
+ agoo_log_cat(&agoo_error_cat, "Server failed to bind server socket. %s.", strerror(errno));
284
284
 
285
- return err_set(err, errno, "Server failed to bind server socket. %s.", strerror(errno));
285
+ return agoo_err_set(err, errno, "Server failed to bind server socket. %s.", strerror(errno));
286
286
  }
287
287
  listen(b->fd, 100);
288
288
 
289
- return ERR_OK;
289
+ return AGOO_ERR_OK;
290
290
  }
291
291
 
292
292
  static int
293
- ssl_listen(Err err, Bind b) {
293
+ ssl_listen(agooErr err, agooBind b) {
294
294
  // TBD
295
- return ERR_OK;
295
+ return AGOO_ERR_OK;
296
296
  }
297
297
 
298
298
  int
299
- bind_listen(Err err, Bind b) {
299
+ agoo_bind_listen(agooErr err, agooBind b) {
300
300
  if (NULL != b->name) {
301
301
  return named_listen(err, b);
302
302
  }
@@ -307,7 +307,7 @@ bind_listen(Err err, Bind b) {
307
307
  }
308
308
 
309
309
  void
310
- bind_close(Bind b) {
310
+ agoo_bind_close(agooBind b) {
311
311
  if (0 != b->fd) {
312
312
  close(b->fd);
313
313
  b->fd = 0;