grpc 1.2.5-universal-darwin → 1.3.4-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/etc/roots.pem +34 -150
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
- data/src/ruby/ext/grpc/rb_channel.c +520 -93
- data/src/ruby/ext/grpc/rb_channel.h +2 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
- data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
- data/src/ruby/ext/grpc/rb_grpc.c +29 -7
- data/src/ruby/ext/grpc/rb_grpc.h +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
- data/src/ruby/ext/grpc/rb_server.c +5 -3
- data/src/ruby/lib/grpc/2.0/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.1/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.2/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.3/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/2.4/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_connection_spec.rb +173 -0
- data/src/ruby/spec/channel_spec.rb +29 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f544f0f71c32fd0ac06bfce91008a2007f6a44a2
|
4
|
+
data.tar.gz: 0bc52ef48cd41f4ef91bbb25b24f0bc54248293f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44b56bc54a4c5898efe06aaa0d42ddf5c45f3e9e32a8d756a582538154f47b2a68158559bb906aada32b625fc199a4df364ed471f1dad92b05b588a99688626f
|
7
|
+
data.tar.gz: 0c86870bf32ff94111539216a7bb74d7a86b5044ed259fc7ee3e9916300acdb21d90e5ccb89f45e782e2c8ca72ca950ffb22672c2a17816db46ae2d6c2e477e0
|
data/etc/roots.pem
CHANGED
@@ -1617,42 +1617,6 @@ wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHN
|
|
1617
1617
|
pGxlaKFJdlxDydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
|
1618
1618
|
-----END CERTIFICATE-----
|
1619
1619
|
|
1620
|
-
# Issuer: CN=WellsSecure Public Root Certificate Authority O=Wells Fargo WellsSecure OU=Wells Fargo Bank NA
|
1621
|
-
# Subject: CN=WellsSecure Public Root Certificate Authority O=Wells Fargo WellsSecure OU=Wells Fargo Bank NA
|
1622
|
-
# Label: "WellsSecure Public Root Certificate Authority"
|
1623
|
-
# Serial: 1
|
1624
|
-
# MD5 Fingerprint: 15:ac:a5:c2:92:2d:79:bc:e8:7f:cb:67:ed:02:cf:36
|
1625
|
-
# SHA1 Fingerprint: e7:b4:f6:9d:61:ec:90:69:db:7e:90:a7:40:1a:3c:f4:7d:4f:e8:ee
|
1626
|
-
# SHA256 Fingerprint: a7:12:72:ae:aa:a3:cf:e8:72:7f:7f:b3:9f:0f:b3:d1:e5:42:6e:90:60:b0:6e:e6:f1:3e:9a:3c:58:33:cd:43
|
1627
|
-
-----BEGIN CERTIFICATE-----
|
1628
|
-
MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMx
|
1629
|
-
IDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxs
|
1630
|
-
cyBGYXJnbyBCYW5rIE5BMTYwN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aqGBi6SBiDCBhTELMAkGA1UEBhMC
|
1645
|
-
VVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNX
|
1646
|
-
ZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
|
1647
|
-
Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEB
|
1648
|
-
ALkVsUSRzCPIK0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd
|
1649
|
-
/ZDJPHV3V3p9+N701NX3leZ0bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pB
|
1650
|
-
A4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSljqHyita04pO2t/caaH/+Xc/77szWn
|
1651
|
-
k4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+esE2fDbbFwRnzVlhE9
|
1652
|
-
iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJtylv
|
1653
|
-
2G0xffX8oRAHh84vWdw+WNs=
|
1654
|
-
-----END CERTIFICATE-----
|
1655
|
-
|
1656
1620
|
# Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited
|
1657
1621
|
# Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited
|
1658
1622
|
# Label: "COMODO ECC Certification Authority"
|
@@ -1738,57 +1702,6 @@ Fj4A4xylNoEYokxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ
|
|
1738
1702
|
/L7fCg0=
|
1739
1703
|
-----END CERTIFICATE-----
|
1740
1704
|
|
1741
|
-
# Issuer: CN=Microsec e-Szigno Root CA O=Microsec Ltd. OU=e-Szigno CA
|
1742
|
-
# Subject: CN=Microsec e-Szigno Root CA O=Microsec Ltd. OU=e-Szigno CA
|
1743
|
-
# Label: "Microsec e-Szigno Root CA"
|
1744
|
-
# Serial: 272122594155480254301341951808045322001
|
1745
|
-
# MD5 Fingerprint: f0:96:b6:2f:c5:10:d5:67:8e:83:25:32:e8:5e:2e:e5
|
1746
|
-
# SHA1 Fingerprint: 23:88:c9:d3:71:cc:9e:96:3d:ff:7d:3c:a7:ce:fc:d6:25:ec:19:0d
|
1747
|
-
# SHA256 Fingerprint: 32:7a:3d:76:1a:ba:de:a0:34:eb:99:84:06:27:5c:b1:a4:77:6e:fd:ae:2f:df:6d:01:68:ea:1c:4f:55:67:d0
|
1748
|
-
-----BEGIN CERTIFICATE-----
|
1749
|
-
MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAw
|
1750
|
-
cjELMAkGA1UEBhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNy
|
1751
|
-
b3NlYyBMdGQuMRQwEgYDVQQLEwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9z
|
1752
|
-
ZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0MDYxMjI4NDRaFw0xNzA0MDYxMjI4
|
1753
|
-
NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEWMBQGA1UEChMN
|
1754
|
-
TWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMTGU1p
|
1755
|
-
Y3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
|
1756
|
-
ggEKAoIBAQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2u
|
1757
|
-
uO/TEdyB5s87lozWbxXGd36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+
|
1758
|
-
LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/NoqdN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nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfR
|
1788
|
-
hUZLphK3dehKyVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/
|
1789
|
-
MPMMNz7UwiiAc7EBt51alhQBS6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
|
1790
|
-
-----END CERTIFICATE-----
|
1791
|
-
|
1792
1705
|
# Issuer: CN=Certigna O=Dhimyotis
|
1793
1706
|
# Subject: CN=Certigna O=Dhimyotis
|
1794
1707
|
# Label: "Certigna"
|
@@ -2014,36 +1927,6 @@ buXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2G8kS1sHNzYDzAgE8yGnLRUhj
|
|
2014
1927
|
2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5mmxE=
|
2015
1928
|
-----END CERTIFICATE-----
|
2016
1929
|
|
2017
|
-
# Issuer: O=Japanese Government OU=ApplicationCA
|
2018
|
-
# Subject: O=Japanese Government OU=ApplicationCA
|
2019
|
-
# Label: "ApplicationCA - Japanese Government"
|
2020
|
-
# Serial: 49
|
2021
|
-
# MD5 Fingerprint: 7e:23:4e:5b:a7:a5:b4:25:e9:00:07:74:11:62:ae:d6
|
2022
|
-
# SHA1 Fingerprint: 7f:8a:b0:cf:d0:51:87:6a:66:f3:36:0f:47:c8:8d:8c:d3:35:fc:74
|
2023
|
-
# SHA256 Fingerprint: 2d:47:43:7d:e1:79:51:21:5a:12:f3:c5:8e:51:c7:29:a5:80:26:ef:1f:cc:0a:5f:b3:d9:dc:01:2f:60:0d:19
|
2024
|
-
-----BEGIN CERTIFICATE-----
|
2025
|
-
MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEc
|
2026
|
-
MBoGA1UEChMTSmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRp
|
2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j3ekav9FfBv7WxfEPjzFvYDio+nEhEMy/0/ecGc/WLuo89U
|
2042
|
-
DNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmWdupwX3kSa+Sj
|
2043
|
-
B1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
|
2044
|
-
rosot4LKGAfmt1t06SAZf7IbiVQ=
|
2045
|
-
-----END CERTIFICATE-----
|
2046
|
-
|
2047
1930
|
# Issuer: CN=GeoTrust Primary Certification Authority - G3 O=GeoTrust Inc. OU=(c) 2008 GeoTrust Inc. - For authorized use only
|
2048
1931
|
# Subject: CN=GeoTrust Primary Certification Authority - G3 O=GeoTrust Inc. OU=(c) 2008 GeoTrust Inc. - For authorized use only
|
2049
1932
|
# Label: "GeoTrust Primary Certification Authority - G3"
|
@@ -4720,39 +4603,6 @@ Yv4HAqGEVka+lgqaE9chTLd8B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW
|
|
4720
4603
|
+qtB4Uu2NQvAmxU=
|
4721
4604
|
-----END CERTIFICATE-----
|
4722
4605
|
|
4723
|
-
# Issuer: CN=TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6 O=TÜRKTRUST Bilgi İletişim ve Bilişim Güvenliği Hizmetleri A.Ş.
|
4724
|
-
# Subject: CN=TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6 O=TÜRKTRUST Bilgi İletişim ve Bilişim Güvenliği Hizmetleri A.Ş.
|
4725
|
-
# Label: "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6"
|
4726
|
-
# Serial: 138134509972618
|
4727
|
-
# MD5 Fingerprint: f8:c5:ee:2a:6b:be:95:8d:08:f7:25:4a:ea:71:3e:46
|
4728
|
-
# SHA1 Fingerprint: 8a:5c:8c:ee:a5:03:e6:05:56:ba:d8:1b:d4:f6:c9:b0:ed:e5:2f:e0
|
4729
|
-
# SHA256 Fingerprint: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Ng9tvYdDjTu0n2pVQ8g9P0p
|
4744
|
-
u5FbHH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6p
|
4745
|
-
lVxiSvgNZ1GpryHV+DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMB
|
4746
|
-
AAGjQjBAMB0GA1UdDgQWBBTdVRcT9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8E
|
4747
|
-
BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAb1gNl0Oq
|
4748
|
-
FlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3RfdCaqaXKGDsC
|
4749
|
-
QC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy
|
4750
|
-
o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKID
|
4751
|
-
gI6tflEATseWhvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm
|
4752
|
-
9ocJV612ph1jmv3XZch4gyt1O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsG
|
4753
|
-
tAuYSyher4hYyw==
|
4754
|
-
-----END CERTIFICATE-----
|
4755
|
-
|
4756
4606
|
# Issuer: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903
|
4757
4607
|
# Subject: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903
|
4758
4608
|
# Label: "Certinomis - Root CA"
|
@@ -5402,3 +5252,37 @@ LSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+
|
|
5402
5252
|
x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31IiyBMz2TWuJdGsE7RKlY6
|
5403
5253
|
oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
|
5404
5254
|
-----END CERTIFICATE-----
|
5255
|
+
|
5256
|
+
# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM
|
5257
|
+
# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM
|
5258
|
+
# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1"
|
5259
|
+
# Serial: 1
|
5260
|
+
# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49
|
5261
|
+
# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca
|
5262
|
+
# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16
|
5263
|
+
-----BEGIN CERTIFICATE-----
|
5264
|
+
MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx
|
5265
|
+
GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp
|
5266
|
+
bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w
|
5267
|
+
KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0
|
5268
|
+
BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy
|
5269
|
+
dW0gMTAeFw0xMzExMjUw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fwbPf
|
5284
|
+
IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4
|
5285
|
+
lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c
|
5286
|
+
8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf
|
5287
|
+
lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
|
5288
|
+
-----END CERTIFICATE-----
|
@@ -71,6 +71,7 @@ ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/
|
|
71
71
|
|
72
72
|
ENV['EMBED_OPENSSL'] = 'true'
|
73
73
|
ENV['EMBED_ZLIB'] = 'true'
|
74
|
+
ENV['EMBED_CARES'] = 'true'
|
74
75
|
ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
|
75
76
|
ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/
|
76
77
|
ENV['CFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
|
@@ -221,6 +221,8 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
|
|
221
221
|
grpc_call_credentials *creds = NULL;
|
222
222
|
grpc_metadata_credentials_plugin plugin;
|
223
223
|
|
224
|
+
grpc_ruby_once_init();
|
225
|
+
|
224
226
|
TypedData_Get_Struct(self, grpc_rb_call_credentials,
|
225
227
|
&grpc_rb_call_credentials_data_type, wrapper);
|
226
228
|
|
@@ -281,8 +283,6 @@ void Init_grpc_call_credentials() {
|
|
281
283
|
grpc_rb_call_credentials_compose, -1);
|
282
284
|
|
283
285
|
id_callback = rb_intern("__callback");
|
284
|
-
|
285
|
-
grpc_rb_event_queue_thread_start();
|
286
286
|
}
|
287
287
|
|
288
288
|
/* Gets the wrapped grpc_call_credentials from the ruby wrapper */
|
@@ -32,26 +32,24 @@
|
|
32
32
|
*/
|
33
33
|
|
34
34
|
#include <ruby/ruby.h>
|
35
|
+
#include <ruby/thread.h>
|
35
36
|
|
36
|
-
#include "rb_grpc_imports.generated.h"
|
37
|
-
#include "rb_channel.h"
|
38
37
|
#include "rb_byte_buffer.h"
|
38
|
+
#include "rb_channel.h"
|
39
|
+
#include "rb_grpc_imports.generated.h"
|
39
40
|
|
40
41
|
#include <grpc/grpc.h>
|
41
42
|
#include <grpc/grpc_security.h>
|
42
43
|
#include <grpc/support/alloc.h>
|
43
44
|
#include <grpc/support/log.h>
|
44
45
|
#include <grpc/support/time.h>
|
45
|
-
#include "rb_grpc.h"
|
46
46
|
#include "rb_call.h"
|
47
47
|
#include "rb_channel_args.h"
|
48
48
|
#include "rb_channel_credentials.h"
|
49
49
|
#include "rb_completion_queue.h"
|
50
|
+
#include "rb_grpc.h"
|
50
51
|
#include "rb_server.h"
|
51
52
|
|
52
|
-
// TODO: During v1.2.x upmerge to master, no changes from this file should go
|
53
|
-
// in to master. This is reverted for 1.2.x only.
|
54
|
-
|
55
53
|
/* id_channel is the name of the hidden ivar that preserves a reference to the
|
56
54
|
* channel on a call, so that calls are not GCed before their channel. */
|
57
55
|
static ID id_channel;
|
@@ -70,15 +68,96 @@ static VALUE grpc_rb_cChannel = Qnil;
|
|
70
68
|
/* Used during the conversion of a hash to channel args during channel setup */
|
71
69
|
static VALUE grpc_rb_cChannelArgs;
|
72
70
|
|
71
|
+
typedef struct bg_watched_channel {
|
72
|
+
grpc_channel *channel;
|
73
|
+
// these fields must only be accessed under global_connection_polling_mu
|
74
|
+
struct bg_watched_channel *next;
|
75
|
+
int channel_destroyed;
|
76
|
+
int refcount;
|
77
|
+
} bg_watched_channel;
|
78
|
+
|
73
79
|
/* grpc_rb_channel wraps a grpc_channel. */
|
74
80
|
typedef struct grpc_rb_channel {
|
75
81
|
VALUE credentials;
|
76
82
|
|
77
|
-
/* The actual channel
|
78
|
-
|
79
|
-
|
83
|
+
/* The actual channel (protected in a wrapper to tell when it's safe to
|
84
|
+
* destroy) */
|
85
|
+
bg_watched_channel *bg_wrapped;
|
80
86
|
} grpc_rb_channel;
|
81
87
|
|
88
|
+
typedef enum { CONTINUOUS_WATCH, WATCH_STATE_API } watch_state_op_type;
|
89
|
+
|
90
|
+
typedef struct watch_state_op {
|
91
|
+
watch_state_op_type op_type;
|
92
|
+
// from event.success
|
93
|
+
union {
|
94
|
+
struct {
|
95
|
+
int success;
|
96
|
+
// has been called back due to a cq next call
|
97
|
+
int called_back;
|
98
|
+
} api_callback_args;
|
99
|
+
struct {
|
100
|
+
bg_watched_channel *bg;
|
101
|
+
} continuous_watch_callback_args;
|
102
|
+
} op;
|
103
|
+
} watch_state_op;
|
104
|
+
|
105
|
+
static bg_watched_channel *bg_watched_channel_list_head = NULL;
|
106
|
+
|
107
|
+
static void grpc_rb_channel_try_register_connection_polling(
|
108
|
+
bg_watched_channel *bg);
|
109
|
+
static void *wait_until_channel_polling_thread_started_no_gil(void *);
|
110
|
+
static void wait_until_channel_polling_thread_started_unblocking_func(void *);
|
111
|
+
static void *channel_init_try_register_connection_polling_without_gil(
|
112
|
+
void *arg);
|
113
|
+
|
114
|
+
typedef struct channel_init_try_register_stack {
|
115
|
+
grpc_channel *channel;
|
116
|
+
grpc_rb_channel *wrapper;
|
117
|
+
} channel_init_try_register_stack;
|
118
|
+
|
119
|
+
static grpc_completion_queue *channel_polling_cq;
|
120
|
+
static gpr_mu global_connection_polling_mu;
|
121
|
+
static gpr_cv global_connection_polling_cv;
|
122
|
+
static int abort_channel_polling = 0;
|
123
|
+
static int channel_polling_thread_started = 0;
|
124
|
+
|
125
|
+
static int bg_watched_channel_list_lookup(bg_watched_channel *bg);
|
126
|
+
static bg_watched_channel *bg_watched_channel_list_create_and_add(
|
127
|
+
grpc_channel *channel);
|
128
|
+
static void bg_watched_channel_list_free_and_remove(bg_watched_channel *bg);
|
129
|
+
static void run_poll_channels_loop_unblocking_func(void *arg);
|
130
|
+
|
131
|
+
// Needs to be called under global_connection_polling_mu
|
132
|
+
static void grpc_rb_channel_watch_connection_state_op_complete(
|
133
|
+
watch_state_op *op, int success) {
|
134
|
+
GPR_ASSERT(!op->op.api_callback_args.called_back);
|
135
|
+
op->op.api_callback_args.called_back = 1;
|
136
|
+
op->op.api_callback_args.success = success;
|
137
|
+
// wake up the watch API call thats waiting on this op
|
138
|
+
gpr_cv_broadcast(&global_connection_polling_cv);
|
139
|
+
}
|
140
|
+
|
141
|
+
/* Avoids destroying a channel twice. */
|
142
|
+
static void grpc_rb_channel_safe_destroy(bg_watched_channel *bg) {
|
143
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
144
|
+
GPR_ASSERT(bg_watched_channel_list_lookup(bg));
|
145
|
+
if (!bg->channel_destroyed) {
|
146
|
+
grpc_channel_destroy(bg->channel);
|
147
|
+
bg->channel_destroyed = 1;
|
148
|
+
}
|
149
|
+
bg->refcount--;
|
150
|
+
if (bg->refcount == 0) {
|
151
|
+
bg_watched_channel_list_free_and_remove(bg);
|
152
|
+
}
|
153
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
154
|
+
}
|
155
|
+
|
156
|
+
static void *channel_safe_destroy_without_gil(void *arg) {
|
157
|
+
grpc_rb_channel_safe_destroy((bg_watched_channel *)arg);
|
158
|
+
return NULL;
|
159
|
+
}
|
160
|
+
|
82
161
|
/* Destroys Channel instances. */
|
83
162
|
static void grpc_rb_channel_free(void *p) {
|
84
163
|
grpc_rb_channel *ch = NULL;
|
@@ -87,9 +166,13 @@ static void grpc_rb_channel_free(void *p) {
|
|
87
166
|
};
|
88
167
|
ch = (grpc_rb_channel *)p;
|
89
168
|
|
90
|
-
if (ch->
|
91
|
-
|
92
|
-
|
169
|
+
if (ch->bg_wrapped != NULL) {
|
170
|
+
/* assumption made here: it's ok to directly gpr_mu_lock the global
|
171
|
+
* connection polling mutex becuse we're in a finalizer,
|
172
|
+
* and we can count on this thread to not be interrupted or
|
173
|
+
* yield the gil. */
|
174
|
+
grpc_rb_channel_safe_destroy(ch->bg_wrapped);
|
175
|
+
ch->bg_wrapped = NULL;
|
93
176
|
}
|
94
177
|
|
95
178
|
xfree(p);
|
@@ -107,20 +190,22 @@ static void grpc_rb_channel_mark(void *p) {
|
|
107
190
|
}
|
108
191
|
}
|
109
192
|
|
110
|
-
static rb_data_type_t grpc_channel_data_type = {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
193
|
+
static rb_data_type_t grpc_channel_data_type = {"grpc_channel",
|
194
|
+
{grpc_rb_channel_mark,
|
195
|
+
grpc_rb_channel_free,
|
196
|
+
GRPC_RB_MEMSIZE_UNAVAILABLE,
|
197
|
+
{NULL, NULL}},
|
198
|
+
NULL,
|
199
|
+
NULL,
|
115
200
|
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
116
|
-
|
201
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
117
202
|
#endif
|
118
203
|
};
|
119
204
|
|
120
205
|
/* Allocates grpc_rb_channel instances. */
|
121
206
|
static VALUE grpc_rb_channel_alloc(VALUE cls) {
|
122
207
|
grpc_rb_channel *wrapper = ALLOC(grpc_rb_channel);
|
123
|
-
wrapper->
|
208
|
+
wrapper->bg_wrapped = NULL;
|
124
209
|
wrapper->credentials = Qnil;
|
125
210
|
return TypedData_Wrap_Struct(cls, &grpc_channel_data_type, wrapper);
|
126
211
|
}
|
@@ -142,8 +227,17 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
|
|
142
227
|
grpc_channel_credentials *creds = NULL;
|
143
228
|
char *target_chars = NULL;
|
144
229
|
grpc_channel_args args;
|
230
|
+
channel_init_try_register_stack stack;
|
231
|
+
int stop_waiting_for_thread_start = 0;
|
145
232
|
MEMZERO(&args, grpc_channel_args, 1);
|
146
233
|
|
234
|
+
grpc_ruby_once_init();
|
235
|
+
rb_thread_call_without_gvl(
|
236
|
+
wait_until_channel_polling_thread_started_no_gil,
|
237
|
+
&stop_waiting_for_thread_start,
|
238
|
+
wait_until_channel_polling_thread_started_unblocking_func,
|
239
|
+
&stop_waiting_for_thread_start);
|
240
|
+
|
147
241
|
/* "3" == 3 mandatory args */
|
148
242
|
rb_scan_args(argc, argv, "3", &target, &channel_args, &credentials);
|
149
243
|
|
@@ -162,6 +256,14 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
|
|
162
256
|
creds = grpc_rb_get_wrapped_channel_credentials(credentials);
|
163
257
|
ch = grpc_secure_channel_create(creds, target_chars, &args, NULL);
|
164
258
|
}
|
259
|
+
|
260
|
+
GPR_ASSERT(ch);
|
261
|
+
stack.channel = ch;
|
262
|
+
stack.wrapper = wrapper;
|
263
|
+
rb_thread_call_without_gvl(
|
264
|
+
channel_init_try_register_connection_polling_without_gil, &stack, NULL,
|
265
|
+
NULL);
|
266
|
+
|
165
267
|
if (args.args != NULL) {
|
166
268
|
xfree(args.args); /* Allocated by grpc_rb_hash_convert_to_channel_args */
|
167
269
|
}
|
@@ -171,98 +273,167 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
|
|
171
273
|
return Qnil;
|
172
274
|
}
|
173
275
|
rb_ivar_set(self, id_target, target);
|
174
|
-
wrapper->wrapped = ch;
|
175
|
-
wrapper->queue = grpc_completion_queue_create(NULL);
|
176
276
|
return self;
|
177
277
|
}
|
178
278
|
|
279
|
+
typedef struct get_state_stack {
|
280
|
+
bg_watched_channel *bg;
|
281
|
+
int try_to_connect;
|
282
|
+
int out;
|
283
|
+
} get_state_stack;
|
284
|
+
|
285
|
+
static void *get_state_without_gil(void *arg) {
|
286
|
+
get_state_stack *stack = (get_state_stack *)arg;
|
287
|
+
|
288
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
289
|
+
GPR_ASSERT(abort_channel_polling || channel_polling_thread_started);
|
290
|
+
if (stack->bg->channel_destroyed) {
|
291
|
+
stack->out = GRPC_CHANNEL_SHUTDOWN;
|
292
|
+
} else {
|
293
|
+
stack->out = grpc_channel_check_connectivity_state(stack->bg->channel,
|
294
|
+
stack->try_to_connect);
|
295
|
+
}
|
296
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
297
|
+
|
298
|
+
return NULL;
|
299
|
+
}
|
300
|
+
|
179
301
|
/*
|
180
302
|
call-seq:
|
181
|
-
|
182
|
-
|
183
|
-
secure_channel = Channel:new("myhost:443", {'arg1': 'value1'}, creds)
|
303
|
+
ch.connectivity_state -> state
|
304
|
+
ch.connectivity_state(true) -> state
|
184
305
|
|
185
|
-
|
306
|
+
Indicates the current state of the channel, whose value is one of the
|
307
|
+
constants defined in GRPC::Core::ConnectivityStates.
|
308
|
+
|
309
|
+
It also tries to connect if the chennel is idle in the second form. */
|
186
310
|
static VALUE grpc_rb_channel_get_connectivity_state(int argc, VALUE *argv,
|
187
311
|
VALUE self) {
|
188
|
-
VALUE
|
312
|
+
VALUE try_to_connect_param = Qfalse;
|
189
313
|
grpc_rb_channel *wrapper = NULL;
|
190
|
-
|
314
|
+
get_state_stack stack;
|
191
315
|
|
192
316
|
/* "01" == 0 mandatory args, 1 (try_to_connect) is optional */
|
193
|
-
rb_scan_args(argc, argv, "01",
|
317
|
+
rb_scan_args(argc, argv, "01", &try_to_connect_param);
|
194
318
|
|
195
319
|
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
196
|
-
|
197
|
-
if (ch == NULL) {
|
320
|
+
if (wrapper->bg_wrapped == NULL) {
|
198
321
|
rb_raise(rb_eRuntimeError, "closed!");
|
199
322
|
return Qnil;
|
200
323
|
}
|
201
|
-
|
202
|
-
|
324
|
+
|
325
|
+
stack.bg = wrapper->bg_wrapped;
|
326
|
+
stack.try_to_connect = RTEST(try_to_connect_param) ? 1 : 0;
|
327
|
+
rb_thread_call_without_gvl(get_state_without_gil, &stack, NULL, NULL);
|
328
|
+
|
329
|
+
return LONG2NUM(stack.out);
|
203
330
|
}
|
204
331
|
|
205
|
-
|
332
|
+
typedef struct watch_state_stack {
|
333
|
+
grpc_channel *channel;
|
334
|
+
gpr_timespec deadline;
|
335
|
+
int last_state;
|
336
|
+
} watch_state_stack;
|
337
|
+
|
338
|
+
static void *wait_for_watch_state_op_complete_without_gvl(void *arg) {
|
339
|
+
watch_state_stack *stack = (watch_state_stack *)arg;
|
340
|
+
watch_state_op *op = NULL;
|
341
|
+
void *success = (void *)0;
|
342
|
+
|
343
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
344
|
+
// its unsafe to do a "watch" after "channel polling abort" because the cq has
|
345
|
+
// been shut down.
|
346
|
+
if (abort_channel_polling) {
|
347
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
348
|
+
return (void *)0;
|
349
|
+
}
|
350
|
+
op = gpr_zalloc(sizeof(watch_state_op));
|
351
|
+
op->op_type = WATCH_STATE_API;
|
352
|
+
grpc_channel_watch_connectivity_state(stack->channel, stack->last_state,
|
353
|
+
stack->deadline, channel_polling_cq,
|
354
|
+
op);
|
355
|
+
|
356
|
+
while (!op->op.api_callback_args.called_back) {
|
357
|
+
gpr_cv_wait(&global_connection_polling_cv, &global_connection_polling_mu,
|
358
|
+
gpr_inf_future(GPR_CLOCK_REALTIME));
|
359
|
+
}
|
360
|
+
if (op->op.api_callback_args.success) {
|
361
|
+
success = (void *)1;
|
362
|
+
}
|
363
|
+
gpr_free(op);
|
364
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
206
365
|
|
207
|
-
|
208
|
-
|
366
|
+
return success;
|
367
|
+
}
|
209
368
|
|
210
|
-
|
211
|
-
|
369
|
+
static void wait_for_watch_state_op_complete_unblocking_func(void *arg) {
|
370
|
+
bg_watched_channel *bg = (bg_watched_channel *)arg;
|
371
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
372
|
+
if (!bg->channel_destroyed) {
|
373
|
+
grpc_channel_destroy(bg->channel);
|
374
|
+
bg->channel_destroyed = 1;
|
375
|
+
}
|
376
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
377
|
+
}
|
378
|
+
|
379
|
+
/* Wait until the channel's connectivity state becomes different from
|
380
|
+
* "last_state", or "deadline" expires.
|
381
|
+
* Returns true if the the channel's connectivity state becomes
|
382
|
+
* different from "last_state" within "deadline".
|
383
|
+
* Returns false if "deadline" expires before the channel's connectivity
|
384
|
+
* state changes from "last_state".
|
385
|
+
* */
|
212
386
|
static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self,
|
213
387
|
VALUE last_state,
|
214
388
|
VALUE deadline) {
|
215
389
|
grpc_rb_channel *wrapper = NULL;
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
void *tag = wrapper;
|
220
|
-
|
221
|
-
grpc_event event;
|
390
|
+
watch_state_stack stack;
|
391
|
+
void *op_success = 0;
|
222
392
|
|
223
393
|
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
224
|
-
|
225
|
-
|
226
|
-
if (ch == NULL) {
|
394
|
+
|
395
|
+
if (wrapper->bg_wrapped == NULL) {
|
227
396
|
rb_raise(rb_eRuntimeError, "closed!");
|
228
397
|
return Qnil;
|
229
398
|
}
|
230
|
-
grpc_channel_watch_connectivity_state(
|
231
|
-
ch,
|
232
|
-
(grpc_connectivity_state)NUM2LONG(last_state),
|
233
|
-
grpc_rb_time_timeval(deadline, /* absolute time */ 0),
|
234
|
-
cq,
|
235
|
-
tag);
|
236
399
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
return
|
242
|
-
} else {
|
243
|
-
return Qfalse;
|
400
|
+
if (!FIXNUM_P(last_state)) {
|
401
|
+
rb_raise(
|
402
|
+
rb_eTypeError,
|
403
|
+
"bad type for last_state. want a GRPC::Core::ChannelState constant");
|
404
|
+
return Qnil;
|
244
405
|
}
|
406
|
+
|
407
|
+
stack.channel = wrapper->bg_wrapped->channel;
|
408
|
+
stack.deadline = grpc_rb_time_timeval(deadline, 0),
|
409
|
+
stack.last_state = NUM2LONG(last_state);
|
410
|
+
|
411
|
+
op_success = rb_thread_call_without_gvl(
|
412
|
+
wait_for_watch_state_op_complete_without_gvl, &stack,
|
413
|
+
wait_for_watch_state_op_complete_unblocking_func, wrapper->bg_wrapped);
|
414
|
+
|
415
|
+
return op_success ? Qtrue : Qfalse;
|
245
416
|
}
|
246
417
|
|
247
418
|
/* Create a call given a grpc_channel, in order to call method. The request
|
248
419
|
is not sent until grpc_call_invoke is called. */
|
249
|
-
static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent,
|
250
|
-
VALUE
|
251
|
-
VALUE
|
420
|
+
static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, VALUE mask,
|
421
|
+
VALUE method, VALUE host,
|
422
|
+
VALUE deadline) {
|
252
423
|
VALUE res = Qnil;
|
253
424
|
grpc_rb_channel *wrapper = NULL;
|
254
425
|
grpc_call *call = NULL;
|
255
426
|
grpc_call *parent_call = NULL;
|
256
|
-
grpc_channel *ch = NULL;
|
257
427
|
grpc_completion_queue *cq = NULL;
|
258
428
|
int flags = GRPC_PROPAGATE_DEFAULTS;
|
259
429
|
grpc_slice method_slice;
|
260
430
|
grpc_slice host_slice;
|
261
431
|
grpc_slice *host_slice_ptr = NULL;
|
262
|
-
char*
|
432
|
+
char *tmp_str = NULL;
|
263
433
|
|
264
434
|
if (host != Qnil) {
|
265
|
-
host_slice =
|
435
|
+
host_slice =
|
436
|
+
grpc_slice_from_copied_buffer(RSTRING_PTR(host), RSTRING_LEN(host));
|
266
437
|
host_slice_ptr = &host_slice;
|
267
438
|
}
|
268
439
|
if (mask != Qnil) {
|
@@ -274,23 +445,23 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent,
|
|
274
445
|
|
275
446
|
cq = grpc_completion_queue_create(NULL);
|
276
447
|
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
277
|
-
|
278
|
-
if (ch == NULL) {
|
448
|
+
if (wrapper->bg_wrapped == NULL) {
|
279
449
|
rb_raise(rb_eRuntimeError, "closed!");
|
280
450
|
return Qnil;
|
281
451
|
}
|
282
452
|
|
283
|
-
method_slice =
|
453
|
+
method_slice =
|
454
|
+
grpc_slice_from_copied_buffer(RSTRING_PTR(method), RSTRING_LEN(method));
|
284
455
|
|
285
|
-
call = grpc_channel_create_call(
|
286
|
-
host_slice_ptr,
|
287
|
-
|
288
|
-
|
456
|
+
call = grpc_channel_create_call(wrapper->bg_wrapped->channel, parent_call,
|
457
|
+
flags, cq, method_slice, host_slice_ptr,
|
458
|
+
grpc_rb_time_timeval(deadline,
|
459
|
+
/* absolute time */ 0),
|
460
|
+
NULL);
|
289
461
|
|
290
462
|
if (call == NULL) {
|
291
463
|
tmp_str = grpc_slice_to_c_string(method_slice);
|
292
|
-
rb_raise(rb_eRuntimeError, "cannot create call with method %s",
|
293
|
-
tmp_str);
|
464
|
+
rb_raise(rb_eRuntimeError, "cannot create call with method %s", tmp_str);
|
294
465
|
return Qnil;
|
295
466
|
}
|
296
467
|
|
@@ -307,41 +478,298 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent,
|
|
307
478
|
return res;
|
308
479
|
}
|
309
480
|
|
310
|
-
|
311
481
|
/* Closes the channel, calling it's destroy method */
|
482
|
+
/* Note this is an API-level call; a wrapped channel's finalizer doesn't call
|
483
|
+
* this */
|
312
484
|
static VALUE grpc_rb_channel_destroy(VALUE self) {
|
313
485
|
grpc_rb_channel *wrapper = NULL;
|
314
|
-
grpc_channel *ch = NULL;
|
315
486
|
|
316
487
|
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
wrapper->
|
488
|
+
if (wrapper->bg_wrapped != NULL) {
|
489
|
+
rb_thread_call_without_gvl(channel_safe_destroy_without_gil,
|
490
|
+
wrapper->bg_wrapped, NULL, NULL);
|
491
|
+
wrapper->bg_wrapped = NULL;
|
321
492
|
}
|
322
493
|
|
323
494
|
return Qnil;
|
324
495
|
}
|
325
496
|
|
326
|
-
|
327
497
|
/* Called to obtain the target that this channel accesses. */
|
328
498
|
static VALUE grpc_rb_channel_get_target(VALUE self) {
|
329
499
|
grpc_rb_channel *wrapper = NULL;
|
330
500
|
VALUE res = Qnil;
|
331
|
-
char*
|
501
|
+
char *target = NULL;
|
332
502
|
|
333
503
|
TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
334
|
-
target = grpc_channel_get_target(wrapper->
|
504
|
+
target = grpc_channel_get_target(wrapper->bg_wrapped->channel);
|
335
505
|
res = rb_str_new2(target);
|
336
506
|
gpr_free(target);
|
337
507
|
|
338
508
|
return res;
|
339
509
|
}
|
340
510
|
|
511
|
+
/* Needs to be called under global_connection_polling_mu */
|
512
|
+
static int bg_watched_channel_list_lookup(bg_watched_channel *target) {
|
513
|
+
bg_watched_channel *cur = bg_watched_channel_list_head;
|
514
|
+
|
515
|
+
while (cur != NULL) {
|
516
|
+
if (cur == target) {
|
517
|
+
return 1;
|
518
|
+
}
|
519
|
+
cur = cur->next;
|
520
|
+
}
|
521
|
+
|
522
|
+
return 0;
|
523
|
+
}
|
524
|
+
|
525
|
+
/* Needs to be called under global_connection_polling_mu */
|
526
|
+
static bg_watched_channel *bg_watched_channel_list_create_and_add(
|
527
|
+
grpc_channel *channel) {
|
528
|
+
bg_watched_channel *watched = gpr_zalloc(sizeof(bg_watched_channel));
|
529
|
+
|
530
|
+
watched->channel = channel;
|
531
|
+
watched->next = bg_watched_channel_list_head;
|
532
|
+
watched->refcount = 1;
|
533
|
+
bg_watched_channel_list_head = watched;
|
534
|
+
return watched;
|
535
|
+
}
|
536
|
+
|
537
|
+
/* Needs to be called under global_connection_polling_mu */
|
538
|
+
static void bg_watched_channel_list_free_and_remove(
|
539
|
+
bg_watched_channel *target) {
|
540
|
+
bg_watched_channel *bg = NULL;
|
541
|
+
|
542
|
+
GPR_ASSERT(bg_watched_channel_list_lookup(target));
|
543
|
+
GPR_ASSERT(target->channel_destroyed && target->refcount == 0);
|
544
|
+
if (bg_watched_channel_list_head == target) {
|
545
|
+
bg_watched_channel_list_head = target->next;
|
546
|
+
gpr_free(target);
|
547
|
+
return;
|
548
|
+
}
|
549
|
+
bg = bg_watched_channel_list_head;
|
550
|
+
while (bg != NULL && bg->next != NULL) {
|
551
|
+
if (bg->next == target) {
|
552
|
+
bg->next = bg->next->next;
|
553
|
+
gpr_free(target);
|
554
|
+
return;
|
555
|
+
}
|
556
|
+
bg = bg->next;
|
557
|
+
}
|
558
|
+
GPR_ASSERT(0);
|
559
|
+
}
|
560
|
+
|
561
|
+
/* Initialize a grpc_rb_channel's "protected grpc_channel" and try to push
|
562
|
+
* it onto the background thread for constant watches. */
|
563
|
+
static void *channel_init_try_register_connection_polling_without_gil(
|
564
|
+
void *arg) {
|
565
|
+
channel_init_try_register_stack *stack =
|
566
|
+
(channel_init_try_register_stack *)arg;
|
567
|
+
|
568
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
569
|
+
stack->wrapper->bg_wrapped =
|
570
|
+
bg_watched_channel_list_create_and_add(stack->channel);
|
571
|
+
grpc_rb_channel_try_register_connection_polling(stack->wrapper->bg_wrapped);
|
572
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
573
|
+
return NULL;
|
574
|
+
}
|
575
|
+
|
576
|
+
// Needs to be called under global_connection_poolling_mu
|
577
|
+
static void grpc_rb_channel_try_register_connection_polling(
|
578
|
+
bg_watched_channel *bg) {
|
579
|
+
grpc_connectivity_state conn_state;
|
580
|
+
watch_state_op *op = NULL;
|
581
|
+
|
582
|
+
GPR_ASSERT(channel_polling_thread_started || abort_channel_polling);
|
583
|
+
|
584
|
+
if (bg->refcount == 0) {
|
585
|
+
GPR_ASSERT(bg->channel_destroyed);
|
586
|
+
bg_watched_channel_list_free_and_remove(bg);
|
587
|
+
return;
|
588
|
+
}
|
589
|
+
GPR_ASSERT(bg->refcount == 1);
|
590
|
+
if (bg->channel_destroyed || abort_channel_polling) {
|
591
|
+
return;
|
592
|
+
}
|
593
|
+
|
594
|
+
conn_state = grpc_channel_check_connectivity_state(bg->channel, 0);
|
595
|
+
if (conn_state == GRPC_CHANNEL_SHUTDOWN) {
|
596
|
+
return;
|
597
|
+
}
|
598
|
+
GPR_ASSERT(bg_watched_channel_list_lookup(bg));
|
599
|
+
// prevent bg from being free'd by GC while background thread is watching it
|
600
|
+
bg->refcount++;
|
601
|
+
|
602
|
+
op = gpr_zalloc(sizeof(watch_state_op));
|
603
|
+
op->op_type = CONTINUOUS_WATCH;
|
604
|
+
op->op.continuous_watch_callback_args.bg = bg;
|
605
|
+
grpc_channel_watch_connectivity_state(bg->channel, conn_state,
|
606
|
+
gpr_inf_future(GPR_CLOCK_REALTIME),
|
607
|
+
channel_polling_cq, op);
|
608
|
+
}
|
609
|
+
|
610
|
+
// Note this loop breaks out with a single call of
|
611
|
+
// "run_poll_channels_loop_no_gil".
|
612
|
+
// This assumes that a ruby call the unblocking func
|
613
|
+
// indicates process shutdown.
|
614
|
+
// In the worst case, this stops polling channel connectivity
|
615
|
+
// early and falls back to current behavior.
|
616
|
+
static void *run_poll_channels_loop_no_gil(void *arg) {
|
617
|
+
grpc_event event;
|
618
|
+
watch_state_op *op = NULL;
|
619
|
+
bg_watched_channel *bg = NULL;
|
620
|
+
(void)arg;
|
621
|
+
gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop_no_gil - begin");
|
622
|
+
|
623
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
624
|
+
GPR_ASSERT(!channel_polling_thread_started);
|
625
|
+
channel_polling_thread_started = 1;
|
626
|
+
gpr_cv_broadcast(&global_connection_polling_cv);
|
627
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
628
|
+
|
629
|
+
for (;;) {
|
630
|
+
event = grpc_completion_queue_next(
|
631
|
+
channel_polling_cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
|
632
|
+
if (event.type == GRPC_QUEUE_SHUTDOWN) {
|
633
|
+
break;
|
634
|
+
}
|
635
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
636
|
+
if (event.type == GRPC_OP_COMPLETE) {
|
637
|
+
op = (watch_state_op *)event.tag;
|
638
|
+
if (op->op_type == CONTINUOUS_WATCH) {
|
639
|
+
bg = (bg_watched_channel *)op->op.continuous_watch_callback_args.bg;
|
640
|
+
bg->refcount--;
|
641
|
+
grpc_rb_channel_try_register_connection_polling(bg);
|
642
|
+
gpr_free(op);
|
643
|
+
} else if (op->op_type == WATCH_STATE_API) {
|
644
|
+
grpc_rb_channel_watch_connection_state_op_complete(
|
645
|
+
(watch_state_op *)event.tag, event.success);
|
646
|
+
} else {
|
647
|
+
GPR_ASSERT(0);
|
648
|
+
}
|
649
|
+
}
|
650
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
651
|
+
}
|
652
|
+
grpc_completion_queue_destroy(channel_polling_cq);
|
653
|
+
gpr_log(GPR_DEBUG,
|
654
|
+
"GRPC_RUBY: run_poll_channels_loop_no_gil - exit connection polling "
|
655
|
+
"loop");
|
656
|
+
return NULL;
|
657
|
+
}
|
658
|
+
|
659
|
+
// Notify the channel polling loop to cleanup and shutdown.
|
660
|
+
static void run_poll_channels_loop_unblocking_func(void *arg) {
|
661
|
+
bg_watched_channel *bg = NULL;
|
662
|
+
(void)arg;
|
663
|
+
|
664
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
665
|
+
gpr_log(GPR_DEBUG,
|
666
|
+
"GRPC_RUBY: run_poll_channels_loop_unblocking_func - begin aborting "
|
667
|
+
"connection polling");
|
668
|
+
// early out after first time through
|
669
|
+
if (abort_channel_polling) {
|
670
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
671
|
+
return;
|
672
|
+
}
|
673
|
+
abort_channel_polling = 1;
|
674
|
+
|
675
|
+
// force pending watches to end by switching to shutdown state
|
676
|
+
bg = bg_watched_channel_list_head;
|
677
|
+
while (bg != NULL) {
|
678
|
+
if (!bg->channel_destroyed) {
|
679
|
+
grpc_channel_destroy(bg->channel);
|
680
|
+
bg->channel_destroyed = 1;
|
681
|
+
}
|
682
|
+
bg = bg->next;
|
683
|
+
}
|
684
|
+
|
685
|
+
grpc_completion_queue_shutdown(channel_polling_cq);
|
686
|
+
gpr_cv_broadcast(&global_connection_polling_cv);
|
687
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
688
|
+
gpr_log(GPR_DEBUG,
|
689
|
+
"GRPC_RUBY: run_poll_channels_loop_unblocking_func - end aborting "
|
690
|
+
"connection polling");
|
691
|
+
}
|
692
|
+
|
693
|
+
// Poll channel connectivity states in background thread without the GIL.
|
694
|
+
static VALUE run_poll_channels_loop(VALUE arg) {
|
695
|
+
(void)arg;
|
696
|
+
gpr_log(
|
697
|
+
GPR_DEBUG,
|
698
|
+
"GRPC_RUBY: run_poll_channels_loop - create connection polling thread");
|
699
|
+
rb_thread_call_without_gvl(run_poll_channels_loop_no_gil, NULL,
|
700
|
+
run_poll_channels_loop_unblocking_func, NULL);
|
701
|
+
|
702
|
+
return Qnil;
|
703
|
+
}
|
704
|
+
|
705
|
+
static void *wait_until_channel_polling_thread_started_no_gil(void *arg) {
|
706
|
+
int *stop_waiting = (int *)arg;
|
707
|
+
gpr_log(GPR_DEBUG, "GRPC_RUBY: wait for channel polling thread to start");
|
708
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
709
|
+
while (!channel_polling_thread_started && !abort_channel_polling &&
|
710
|
+
!*stop_waiting) {
|
711
|
+
gpr_cv_wait(&global_connection_polling_cv, &global_connection_polling_mu,
|
712
|
+
gpr_inf_future(GPR_CLOCK_REALTIME));
|
713
|
+
}
|
714
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
715
|
+
|
716
|
+
return NULL;
|
717
|
+
}
|
718
|
+
|
719
|
+
static void wait_until_channel_polling_thread_started_unblocking_func(
|
720
|
+
void *arg) {
|
721
|
+
int *stop_waiting = (int *)arg;
|
722
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
723
|
+
gpr_log(GPR_DEBUG,
|
724
|
+
"GRPC_RUBY: interrupt wait for channel polling thread to start");
|
725
|
+
*stop_waiting = 1;
|
726
|
+
gpr_cv_broadcast(&global_connection_polling_cv);
|
727
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
728
|
+
}
|
729
|
+
|
730
|
+
static void *set_abort_channel_polling_without_gil(void *arg) {
|
731
|
+
(void)arg;
|
732
|
+
gpr_mu_lock(&global_connection_polling_mu);
|
733
|
+
abort_channel_polling = 1;
|
734
|
+
gpr_cv_broadcast(&global_connection_polling_cv);
|
735
|
+
gpr_mu_unlock(&global_connection_polling_mu);
|
736
|
+
return NULL;
|
737
|
+
}
|
738
|
+
|
739
|
+
/* Temporary fix for
|
740
|
+
* https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues/899.
|
741
|
+
* Transports in idle channels can get destroyed. Normally c-core re-connects,
|
742
|
+
* but in grpc-ruby core never gets a thread until an RPC is made, because ruby
|
743
|
+
* only calls c-core's "completion_queu_pluck" API.
|
744
|
+
* This uses a global background thread that calls
|
745
|
+
* "completion_queue_next" on registered "watch_channel_connectivity_state"
|
746
|
+
* calls - so that c-core can reconnect if needed, when there aren't any RPC's.
|
747
|
+
* TODO(apolcyn) remove this when core handles new RPCs on dead connections.
|
748
|
+
*/
|
749
|
+
void grpc_rb_channel_polling_thread_start() {
|
750
|
+
VALUE background_thread = Qnil;
|
751
|
+
|
752
|
+
GPR_ASSERT(!abort_channel_polling);
|
753
|
+
GPR_ASSERT(!channel_polling_thread_started);
|
754
|
+
GPR_ASSERT(channel_polling_cq == NULL);
|
755
|
+
|
756
|
+
gpr_mu_init(&global_connection_polling_mu);
|
757
|
+
gpr_cv_init(&global_connection_polling_cv);
|
758
|
+
|
759
|
+
channel_polling_cq = grpc_completion_queue_create(NULL);
|
760
|
+
background_thread = rb_thread_create(run_poll_channels_loop, NULL);
|
761
|
+
|
762
|
+
if (!RTEST(background_thread)) {
|
763
|
+
gpr_log(GPR_DEBUG, "GRPC_RUBY: failed to spawn channel polling thread");
|
764
|
+
rb_thread_call_without_gvl(set_abort_channel_polling_without_gil, NULL,
|
765
|
+
NULL, NULL);
|
766
|
+
}
|
767
|
+
}
|
768
|
+
|
341
769
|
static void Init_grpc_propagate_masks() {
|
342
770
|
/* Constants representing call propagation masks in grpc.h */
|
343
|
-
VALUE grpc_rb_mPropagateMasks =
|
344
|
-
grpc_rb_mGrpcCore, "PropagateMasks");
|
771
|
+
VALUE grpc_rb_mPropagateMasks =
|
772
|
+
rb_define_module_under(grpc_rb_mGrpcCore, "PropagateMasks");
|
345
773
|
rb_define_const(grpc_rb_mPropagateMasks, "DEADLINE",
|
346
774
|
UINT2NUM(GRPC_PROPAGATE_DEADLINE));
|
347
775
|
rb_define_const(grpc_rb_mPropagateMasks, "CENSUS_STATS_CONTEXT",
|
@@ -356,8 +784,8 @@ static void Init_grpc_propagate_masks() {
|
|
356
784
|
|
357
785
|
static void Init_grpc_connectivity_states() {
|
358
786
|
/* Constants representing call propagation masks in grpc.h */
|
359
|
-
VALUE grpc_rb_mConnectivityStates =
|
360
|
-
grpc_rb_mGrpcCore, "ConnectivityStates");
|
787
|
+
VALUE grpc_rb_mConnectivityStates =
|
788
|
+
rb_define_module_under(grpc_rb_mGrpcCore, "ConnectivityStates");
|
361
789
|
rb_define_const(grpc_rb_mConnectivityStates, "IDLE",
|
362
790
|
LONG2NUM(GRPC_CHANNEL_IDLE));
|
363
791
|
rb_define_const(grpc_rb_mConnectivityStates, "CONNECTING",
|
@@ -385,12 +813,11 @@ void Init_grpc_channel() {
|
|
385
813
|
|
386
814
|
/* Add ruby analogues of the Channel methods. */
|
387
815
|
rb_define_method(grpc_rb_cChannel, "connectivity_state",
|
388
|
-
grpc_rb_channel_get_connectivity_state,
|
389
|
-
-1);
|
816
|
+
grpc_rb_channel_get_connectivity_state, -1);
|
390
817
|
rb_define_method(grpc_rb_cChannel, "watch_connectivity_state",
|
391
|
-
grpc_rb_channel_watch_connectivity_state,
|
392
|
-
rb_define_method(grpc_rb_cChannel, "create_call",
|
393
|
-
|
818
|
+
grpc_rb_channel_watch_connectivity_state, 2);
|
819
|
+
rb_define_method(grpc_rb_cChannel, "create_call", grpc_rb_channel_create_call,
|
820
|
+
5);
|
394
821
|
rb_define_method(grpc_rb_cChannel, "target", grpc_rb_channel_get_target, 0);
|
395
822
|
rb_define_method(grpc_rb_cChannel, "destroy", grpc_rb_channel_destroy, 0);
|
396
823
|
rb_define_alias(grpc_rb_cChannel, "close", "destroy");
|
@@ -414,5 +841,5 @@ void Init_grpc_channel() {
|
|
414
841
|
grpc_channel *grpc_rb_get_wrapped_channel(VALUE v) {
|
415
842
|
grpc_rb_channel *wrapper = NULL;
|
416
843
|
TypedData_Get_Struct(v, grpc_rb_channel, &grpc_channel_data_type, wrapper);
|
417
|
-
return wrapper->
|
844
|
+
return wrapper->bg_wrapped->channel;
|
418
845
|
}
|