asyncproxy 1.0__tar.gz → 1.1__tar.gz
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.
- asyncproxy-1.1/MANIFEST.in +2 -0
- {asyncproxy-1.0/asyncproxy.egg-info → asyncproxy-1.1}/PKG-INFO +11 -2
- {asyncproxy-1.0 → asyncproxy-1.1}/README.md +8 -0
- {asyncproxy-1.0 → asyncproxy-1.1/asyncproxy.egg-info}/PKG-INFO +11 -2
- {asyncproxy-1.0 → asyncproxy-1.1}/setup.py +9 -6
- {asyncproxy-1.0 → asyncproxy-1.1}/src/asp_sock.c +6 -4
- {asyncproxy-1.0 → asyncproxy-1.1}/src/asyncproxy.c +15 -14
- asyncproxy-1.0/MANIFEST.in +0 -2
- {asyncproxy-1.0 → asyncproxy-1.1}/LICENSE +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/asyncproxy.egg-info/SOURCES.txt +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/asyncproxy.egg-info/dependency_links.txt +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/asyncproxy.egg-info/top_level.txt +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/python/AsyncProxy.py +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/python/Forwarder.py +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/python/ForwarderFast.py +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/python/TCPProxy.py +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/python/env.py +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/setup.cfg +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/src/Symbol.map +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/src/asp_iostats.h +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/src/asp_sock.h +0 -0
- {asyncproxy-1.0 → asyncproxy-1.1}/src/asyncproxy.h +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: asyncproxy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1
|
|
4
4
|
Summary: Background TCP proxy for async IO
|
|
5
5
|
Home-page: https://github.com/sippy/libasyncproxy.git
|
|
6
6
|
Author: Maksym Sobolyev
|
|
7
7
|
Author-email: sobomax@sippysoft.com
|
|
8
|
-
|
|
8
|
+
License: BSD-2-Clause
|
|
9
9
|
Classifier: Operating System :: POSIX
|
|
10
10
|
Classifier: Programming Language :: C
|
|
11
11
|
Classifier: Programming Language :: Python
|
|
@@ -17,9 +17,12 @@ Dynamic: classifier
|
|
|
17
17
|
Dynamic: description
|
|
18
18
|
Dynamic: description-content-type
|
|
19
19
|
Dynamic: home-page
|
|
20
|
+
Dynamic: license
|
|
20
21
|
Dynamic: license-file
|
|
21
22
|
Dynamic: summary
|
|
22
23
|
|
|
24
|
+
[](https://github.com/sippy/libasyncproxy/actions/workflows/build_and_test.yml)
|
|
25
|
+
|
|
23
26
|
# libasyncproxy
|
|
24
27
|
|
|
25
28
|
## Introduction
|
|
@@ -67,6 +70,12 @@ Forwarder if that fails to load or initialize.
|
|
|
67
70
|
We use this library to allow applications to be redirected to one of several
|
|
68
71
|
available DB replicas and re-routed instantly if the configuration changes.
|
|
69
72
|
|
|
73
|
+
## Install Python module from PyPy:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
pip install asyncproxy
|
|
77
|
+
```
|
|
78
|
+
|
|
70
79
|
## Build and Install Python module from source code:
|
|
71
80
|
|
|
72
81
|
```
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://github.com/sippy/libasyncproxy/actions/workflows/build_and_test.yml)
|
|
2
|
+
|
|
1
3
|
# libasyncproxy
|
|
2
4
|
|
|
3
5
|
## Introduction
|
|
@@ -45,6 +47,12 @@ Forwarder if that fails to load or initialize.
|
|
|
45
47
|
We use this library to allow applications to be redirected to one of several
|
|
46
48
|
available DB replicas and re-routed instantly if the configuration changes.
|
|
47
49
|
|
|
50
|
+
## Install Python module from PyPy:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
pip install asyncproxy
|
|
54
|
+
```
|
|
55
|
+
|
|
48
56
|
## Build and Install Python module from source code:
|
|
49
57
|
|
|
50
58
|
```
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: asyncproxy
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1
|
|
4
4
|
Summary: Background TCP proxy for async IO
|
|
5
5
|
Home-page: https://github.com/sippy/libasyncproxy.git
|
|
6
6
|
Author: Maksym Sobolyev
|
|
7
7
|
Author-email: sobomax@sippysoft.com
|
|
8
|
-
|
|
8
|
+
License: BSD-2-Clause
|
|
9
9
|
Classifier: Operating System :: POSIX
|
|
10
10
|
Classifier: Programming Language :: C
|
|
11
11
|
Classifier: Programming Language :: Python
|
|
@@ -17,9 +17,12 @@ Dynamic: classifier
|
|
|
17
17
|
Dynamic: description
|
|
18
18
|
Dynamic: description-content-type
|
|
19
19
|
Dynamic: home-page
|
|
20
|
+
Dynamic: license
|
|
20
21
|
Dynamic: license-file
|
|
21
22
|
Dynamic: summary
|
|
22
23
|
|
|
24
|
+
[](https://github.com/sippy/libasyncproxy/actions/workflows/build_and_test.yml)
|
|
25
|
+
|
|
23
26
|
# libasyncproxy
|
|
24
27
|
|
|
25
28
|
## Introduction
|
|
@@ -67,6 +70,12 @@ Forwarder if that fails to load or initialize.
|
|
|
67
70
|
We use this library to allow applications to be redirected to one of several
|
|
68
71
|
available DB replicas and re-routed instantly if the configuration changes.
|
|
69
72
|
|
|
73
|
+
## Install Python module from PyPy:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
pip install asyncproxy
|
|
77
|
+
```
|
|
78
|
+
|
|
70
79
|
## Build and Install Python module from source code:
|
|
71
80
|
|
|
72
81
|
```
|
|
@@ -24,10 +24,13 @@ extra_link_args = ['-flto'] if not is_win else []
|
|
|
24
24
|
|
|
25
25
|
debug_opts = ('-g3', '-O0')
|
|
26
26
|
nodebug_opts = ('-DNO_DEBUG',)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
nodebug_opts += ('-O3',) if not is_win else ()
|
|
28
|
+
|
|
29
|
+
if get_platform() == 'linux-x86_64':
|
|
30
|
+
# This is to disable x86-64-v2, see
|
|
31
|
+
# https://github.com/pypa/manylinux/issues/1725
|
|
32
|
+
extra_compile_args.append('-march=x86-64')
|
|
33
|
+
|
|
31
34
|
if False:
|
|
32
35
|
extra_compile_args.extend(debug_opts)
|
|
33
36
|
extra_link_args.extend(debug_opts)
|
|
@@ -53,7 +56,7 @@ with open("README.md", "r") as fh:
|
|
|
53
56
|
long_description = fh.read()
|
|
54
57
|
|
|
55
58
|
kwargs = {'name':'asyncproxy',
|
|
56
|
-
'version':'1.
|
|
59
|
+
'version':'1.1',
|
|
57
60
|
'description':'Background TCP proxy for async IO',
|
|
58
61
|
'long_description': long_description,
|
|
59
62
|
'long_description_content_type': "text/markdown",
|
|
@@ -63,8 +66,8 @@ kwargs = {'name':'asyncproxy',
|
|
|
63
66
|
'packages':['asyncproxy',],
|
|
64
67
|
'package_dir':{'asyncproxy':'python'},
|
|
65
68
|
'ext_modules': get_ex_mod(),
|
|
69
|
+
'license': 'BSD-2-Clause',
|
|
66
70
|
'classifiers': [
|
|
67
|
-
'License :: OSI Approved :: BSD License',
|
|
68
71
|
'Operating System :: POSIX',
|
|
69
72
|
'Programming Language :: C',
|
|
70
73
|
'Programming Language :: Python'
|
|
@@ -26,21 +26,23 @@ asp_sock_recv(struct asp_sock *asp, void *buf, size_t len)
|
|
|
26
26
|
int update_stats;
|
|
27
27
|
|
|
28
28
|
update_stats = 0;
|
|
29
|
-
pthread_mutex_lock(&asp->mutex);
|
|
30
29
|
r.len = recv(asp->fd, buf, len, 0);
|
|
31
30
|
if (r.len > 0) {
|
|
31
|
+
pthread_mutex_lock(&asp->mutex);
|
|
32
32
|
asp->stats.in.nops++;
|
|
33
33
|
asp->stats.in.btotal += r.len;
|
|
34
34
|
if (asp->on_stats_update != NULL) {
|
|
35
35
|
tstats = asp->stats;
|
|
36
36
|
update_stats = 1;
|
|
37
|
+
} else {
|
|
38
|
+
pthread_mutex_unlock(&asp->mutex);
|
|
37
39
|
}
|
|
38
40
|
} else {
|
|
39
41
|
r.errnom = errno;
|
|
40
42
|
}
|
|
41
|
-
pthread_mutex_unlock(&asp->mutex);
|
|
42
43
|
if (update_stats) {
|
|
43
44
|
asp->on_stats_update(&tstats);
|
|
45
|
+
pthread_mutex_unlock(&asp->mutex);
|
|
44
46
|
}
|
|
45
47
|
return (r);
|
|
46
48
|
}
|
|
@@ -50,12 +52,12 @@ asp_sock_send(struct asp_sock *asp, const void *msg, size_t len)
|
|
|
50
52
|
{
|
|
51
53
|
ssize_t rlen;
|
|
52
54
|
|
|
53
|
-
pthread_mutex_lock(&asp->mutex);
|
|
54
55
|
rlen = send(asp->fd, msg, len, 0);
|
|
55
56
|
if (rlen > 0) {
|
|
57
|
+
pthread_mutex_lock(&asp->mutex);
|
|
56
58
|
asp->stats.out.nops++;
|
|
57
59
|
asp->stats.out.btotal += rlen;
|
|
60
|
+
pthread_mutex_unlock(&asp->mutex);
|
|
58
61
|
}
|
|
59
|
-
pthread_mutex_unlock(&asp->mutex);
|
|
60
62
|
return (rlen);
|
|
61
63
|
}
|
|
@@ -200,7 +200,7 @@ asyncproxy_run(void *args)
|
|
|
200
200
|
|
|
201
201
|
ap = (struct asyncproxy *)args;
|
|
202
202
|
if (ap->debug > 1) {
|
|
203
|
-
fprintf(stderr, "asyncproxy_run(%p)\n", ap);
|
|
203
|
+
fprintf(stderr, "asyncproxy_run(%p)\n", (void *)ap);
|
|
204
204
|
fflush(stderr);
|
|
205
205
|
}
|
|
206
206
|
pthread_mutex_lock(&ap->mutex);
|
|
@@ -239,7 +239,7 @@ asyncproxy_run(void *args)
|
|
|
239
239
|
pthread_mutex_unlock(&ap->mutex);
|
|
240
240
|
if (state != AP_STATE_RUN) {
|
|
241
241
|
if (ap->debug > 2) {
|
|
242
|
-
fprintf(stderr, "asyncproxy_run(%p): exit on state %d\n", ap, state);
|
|
242
|
+
fprintf(stderr, "asyncproxy_run(%p): exit on state %d\n", (void *)ap, state);
|
|
243
243
|
fflush(stderr);
|
|
244
244
|
}
|
|
245
245
|
break;
|
|
@@ -250,7 +250,7 @@ asyncproxy_run(void *args)
|
|
|
250
250
|
fflush(stderr);
|
|
251
251
|
}
|
|
252
252
|
if (ap->debug > 3) {
|
|
253
|
-
fprintf(stderr, "asyncproxy_run(%p): poll() = %d\n", ap, n);
|
|
253
|
+
fprintf(stderr, "asyncproxy_run(%p): poll() = %d\n", (void *)ap, n);
|
|
254
254
|
fflush(stderr);
|
|
255
255
|
}
|
|
256
256
|
if (n <= 0) {
|
|
@@ -260,14 +260,15 @@ asyncproxy_run(void *args)
|
|
|
260
260
|
for (i = 0; i < 2; i++) {
|
|
261
261
|
if (ap->debug > 0) {
|
|
262
262
|
if (ap->debug > 3) {
|
|
263
|
-
fprintf(stderr, "asyncproxy_run(%p): pfds[%d] = {.events = %d, .revents = %d}\n",
|
|
263
|
+
fprintf(stderr, "asyncproxy_run(%p): pfds[%d] = {.events = %d, .revents = %d}\n",
|
|
264
|
+
(void *)ap, i, pfds[i].events, pfds[i].revents);
|
|
264
265
|
fflush(stderr);
|
|
265
266
|
}
|
|
266
267
|
assert((pfds[i].revents & POLLNVAL) == 0);
|
|
267
268
|
}
|
|
268
269
|
if (pfds[i].revents & POLLHUP) {
|
|
269
270
|
if (ap->debug > 1) {
|
|
270
|
-
fprintf(stderr, "asyncproxy_run(%p): fd %d is gone, out\n", ap, pfds[i].fd);
|
|
271
|
+
fprintf(stderr, "asyncproxy_run(%p): fd %d is gone, out\n", (void *)ap, pfds[i].fd);
|
|
271
272
|
fflush(stderr);
|
|
272
273
|
}
|
|
273
274
|
eidx = i;
|
|
@@ -279,13 +280,13 @@ asyncproxy_run(void *args)
|
|
|
279
280
|
r = asp_sock_recv(asps[i], BUF_P(&bufs[i]), BUF_FREE(&bufs[i]));
|
|
280
281
|
if (ap->debug > 2) {
|
|
281
282
|
assert(pfds[i].fd == asps[i]->fd);
|
|
282
|
-
fprintf(stderr, "asyncproxy_run(%p): received %ld bytes from %d\n", ap, r.len, pfds[i].fd);
|
|
283
|
+
fprintf(stderr, "asyncproxy_run(%p): received %ld bytes from %d\n", (void *)ap, r.len, pfds[i].fd);
|
|
283
284
|
fflush(stderr);
|
|
284
285
|
}
|
|
285
286
|
if (r.len <= 0) {
|
|
286
287
|
if (ap->debug > 1) {
|
|
287
288
|
fprintf(stderr, "asyncproxy_run(%p): fd %d recv "
|
|
288
|
-
"failed with error %d, out\n", ap, pfds[i].fd,
|
|
289
|
+
"failed with error %d, out\n", (void *)ap, pfds[i].fd,
|
|
289
290
|
r.errnom);
|
|
290
291
|
fflush(stderr);
|
|
291
292
|
}
|
|
@@ -335,7 +336,7 @@ asyncproxy_run(void *args)
|
|
|
335
336
|
rlen = asp_sock_send(asps[j], bufs[i].data, bufs[i].len);
|
|
336
337
|
if (ap->debug > 2) {
|
|
337
338
|
assert(pfds[j].fd == asps[j]->fd);
|
|
338
|
-
fprintf(stderr, "asyncproxy_run(%p): sent %ld bytes to %d\n", ap, rlen, pfds[j].fd);
|
|
339
|
+
fprintf(stderr, "asyncproxy_run(%p): sent %ld bytes to %d\n", (void *)ap, rlen, pfds[j].fd);
|
|
339
340
|
fflush(stderr);
|
|
340
341
|
}
|
|
341
342
|
if (rlen < (ssize_t)bufs[i].len) {
|
|
@@ -373,7 +374,7 @@ out:
|
|
|
373
374
|
pthread_mutex_unlock(&ap->mutex);
|
|
374
375
|
|
|
375
376
|
if (ap->debug > 0) {
|
|
376
|
-
fprintf(stderr, "cease asyncproxy_run(%p)\n", ap);
|
|
377
|
+
fprintf(stderr, "cease asyncproxy_run(%p)\n", (void *)ap);
|
|
377
378
|
fflush(stderr);
|
|
378
379
|
}
|
|
379
380
|
|
|
@@ -407,7 +408,7 @@ asyncproxy_ctor(const struct asyncproxy_ctor_args *acap)
|
|
|
407
408
|
return (NULL);
|
|
408
409
|
}
|
|
409
410
|
if (dbg_level > 0) {
|
|
410
|
-
fprintf(stderr, "%p\n", ap);
|
|
411
|
+
fprintf(stderr, "%p\n", (void *)ap);
|
|
411
412
|
fflush(stderr);
|
|
412
413
|
}
|
|
413
414
|
memset(ap, '\0', sizeof(struct asyncproxy));
|
|
@@ -492,7 +493,7 @@ finalize:
|
|
|
492
493
|
goto e3;
|
|
493
494
|
}
|
|
494
495
|
|
|
495
|
-
#if defined(PYTHON_AWARE)
|
|
496
|
+
#if defined(PYTHON_AWARE) && PY_VERSION_HEX < 0x03070000
|
|
496
497
|
PyEval_InitThreads();
|
|
497
498
|
#endif
|
|
498
499
|
|
|
@@ -517,7 +518,7 @@ asyncproxy_start(void *_ap)
|
|
|
517
518
|
|
|
518
519
|
ap = (struct asyncproxy *)_ap;
|
|
519
520
|
if (ap->debug > 0) {
|
|
520
|
-
fprintf(stderr, "asyncproxy_start(%p)\n", ap);
|
|
521
|
+
fprintf(stderr, "asyncproxy_start(%p)\n", (void *)ap);
|
|
521
522
|
fflush(stderr);
|
|
522
523
|
}
|
|
523
524
|
pthread_mutex_lock(&ap->mutex);
|
|
@@ -545,7 +546,7 @@ asyncproxy_dtor(void *_ap)
|
|
|
545
546
|
|
|
546
547
|
ap = (struct asyncproxy *)_ap;
|
|
547
548
|
if (ap->debug > 0) {
|
|
548
|
-
fprintf(stderr, "asyncproxy_dtor(%p)\n", ap);
|
|
549
|
+
fprintf(stderr, "asyncproxy_dtor(%p)\n", (void *)ap);
|
|
549
550
|
fflush(stderr);
|
|
550
551
|
}
|
|
551
552
|
|
|
@@ -573,7 +574,7 @@ asyncproxy_isalive(void *_ap)
|
|
|
573
574
|
pthread_mutex_unlock(&ap->mutex);
|
|
574
575
|
|
|
575
576
|
if (ap->debug > 1 && ap->last_seen_alive != rval) {
|
|
576
|
-
fprintf(stderr, "asyncproxy_isalive(%p) = %d->%d\n", ap, ap->last_seen_alive, rval);
|
|
577
|
+
fprintf(stderr, "asyncproxy_isalive(%p) = %d->%d\n", (void *)ap, ap->last_seen_alive, rval);
|
|
577
578
|
fflush(stderr);
|
|
578
579
|
ap->last_seen_alive = rval;
|
|
579
580
|
}
|
asyncproxy-1.0/MANIFEST.in
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|