eventmachine 1.2.0.1-x64-mingw32 → 1.2.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +25 -23
- data/ext/ed.cpp +40 -65
- data/ext/ed.h +23 -8
- data/ext/em.cpp +23 -12
- data/ext/em.h +1 -1
- data/ext/rubymain.cpp +19 -15
- data/java/src/com/rubyeventmachine/EmReactor.java +18 -2
- data/lib/2.0/fastfilereaderext.so +0 -0
- data/lib/2.0/rubyeventmachine.so +0 -0
- data/lib/2.1/fastfilereaderext.so +0 -0
- data/lib/2.1/rubyeventmachine.so +0 -0
- data/lib/2.2/fastfilereaderext.so +0 -0
- data/lib/2.2/rubyeventmachine.so +0 -0
- data/lib/2.3/fastfilereaderext.so +0 -0
- data/lib/2.3/rubyeventmachine.so +0 -0
- data/lib/em/pool.rb +35 -35
- data/lib/em/protocols/linetext2.rb +18 -5
- data/lib/em/pure_ruby.rb +290 -52
- data/lib/em/version.rb +1 -1
- data/lib/eventmachine.rb +6 -0
- data/lib/jeventmachine.rb +2 -0
- data/rakelib/test_pure.rake +13 -0
- data/tests/em_test_helper.rb +3 -0
- data/tests/test_basic.rb +32 -0
- data/tests/test_ltp2.rb +24 -0
- data/tests/test_pure.rb +51 -0
- data/tests/test_ssl_dhparam.rb +2 -1
- data/tests/test_ssl_ecdh_curve.rb +2 -1
- data/tests/test_ssl_extensions.rb +1 -1
- data/tests/test_ssl_protocols.rb +3 -3
- data/tests/test_ssl_verify.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef797511a403ea13089c8e505a5394705138c55
|
4
|
+
data.tar.gz: 3d040218c0909e57e36e2c4343860b9c899e057b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c47293c982979b53e7cf6fd1f0afea0f1ba1497a30aa7ed96a920cc9a7d3703e5a696aaf1a6340d09c451d0f7d5fea0a95a35065bd924c9d89a3ca4594b887ac
|
7
|
+
data.tar.gz: 2f347642fdd0f183f56c0c4b279978b1c84fd4c7a2b4d7451024ebb60575efa704f3db9bc98755dca787324da4e72d07ffa6a22528d2ad14257c80b2cbbec5a8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.2.1 (November 15, 2016)
|
4
|
+
* Throw strerror(errno) when getsockname or getpeername fail [#683]
|
5
|
+
* Use a single concrete implementation of getpeername/getsockname, the rest pure virtuals [#683]
|
6
|
+
* Use gai_strerror to get the failure string from getaddrinfo [#744]
|
7
|
+
* Fix deregistering descriptor when using KQUEUE [#728]
|
8
|
+
* Fix to enable to work an example code in EM::Pool [#731]
|
9
|
+
* LineText2: Add regular expression delimiter support [#706]
|
10
|
+
* Pure Ruby: EM rescue ECONNREFUSED on initial TCP connect [#741]
|
11
|
+
* Pure Ruby: EM SSL (working start_tls) [#712]
|
12
|
+
* Pure Ruby: EM fixes [#707]
|
13
|
+
* Java: Use Acceptors to get peer and sock names if not present in Connections [#743]
|
14
|
+
|
3
15
|
## 1.2.0.1 (March 15, 2016)
|
4
16
|
* Fix crash when accepting IPv6 connections due to struct sockaddr_in [#698, #699]
|
5
17
|
|
data/README.md
CHANGED
@@ -32,7 +32,7 @@ EventMachine has been around since the early 2000s and is a mature and battle-te
|
|
32
32
|
|
33
33
|
## What platforms are supported by EventMachine? ##
|
34
34
|
|
35
|
-
EventMachine supports Ruby
|
35
|
+
EventMachine supports Ruby 1.8.7 through 2.3, REE, JRuby and **works well on Windows** as well
|
36
36
|
as many operating systems from the Unix family (Linux, Mac OS X, BSD flavors).
|
37
37
|
|
38
38
|
|
@@ -54,34 +54,36 @@ or add this to your Gemfile if you use [Bundler](http://gembundler.com/):
|
|
54
54
|
For an introduction to EventMachine, check out:
|
55
55
|
|
56
56
|
* [blog post about EventMachine by Ilya Grigorik](http://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/).
|
57
|
-
* [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions
|
57
|
+
* [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions.html).
|
58
58
|
|
59
59
|
|
60
60
|
### Server example: Echo server ###
|
61
61
|
|
62
62
|
Here's a fully-functional echo server written with EventMachine:
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
64
|
+
```ruby
|
65
|
+
require 'eventmachine'
|
66
|
+
|
67
|
+
module EchoServer
|
68
|
+
def post_init
|
69
|
+
puts "-- someone connected to the echo server!"
|
70
|
+
end
|
71
|
+
|
72
|
+
def receive_data data
|
73
|
+
send_data ">>>you sent: #{data}"
|
74
|
+
close_connection if data =~ /quit/i
|
75
|
+
end
|
76
|
+
|
77
|
+
def unbind
|
78
|
+
puts "-- someone disconnected from the echo server!"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Note that this will block current thread.
|
83
|
+
EventMachine.run {
|
84
|
+
EventMachine.start_server "127.0.0.1", 8081, EchoServer
|
85
|
+
}
|
86
|
+
```
|
85
87
|
|
86
88
|
|
87
89
|
## EventMachine documentation ##
|
data/ext/ed.cpp
CHANGED
@@ -340,6 +340,45 @@ void EventableDescriptor::_GenericInboundDispatch(const char *buf, unsigned long
|
|
340
340
|
}
|
341
341
|
|
342
342
|
|
343
|
+
/*********************************
|
344
|
+
EventableDescriptor::_GenericGetPeername
|
345
|
+
*********************************/
|
346
|
+
|
347
|
+
bool EventableDescriptor::_GenericGetPeername (struct sockaddr *s, socklen_t *len)
|
348
|
+
{
|
349
|
+
if (!s)
|
350
|
+
return false;
|
351
|
+
|
352
|
+
int gp = getpeername (GetSocket(), s, len);
|
353
|
+
if (gp == -1) {
|
354
|
+
char buf[200];
|
355
|
+
snprintf (buf, sizeof(buf)-1, "unable to get peer name: %s", strerror(errno));
|
356
|
+
throw std::runtime_error (buf);
|
357
|
+
}
|
358
|
+
|
359
|
+
return true;
|
360
|
+
}
|
361
|
+
|
362
|
+
/*********************************
|
363
|
+
EventableDescriptor::_GenericGetSockname
|
364
|
+
*********************************/
|
365
|
+
|
366
|
+
bool EventableDescriptor::_GenericGetSockname (struct sockaddr *s, socklen_t *len)
|
367
|
+
{
|
368
|
+
if (!s)
|
369
|
+
return false;
|
370
|
+
|
371
|
+
int gp = getsockname (GetSocket(), s, len);
|
372
|
+
if (gp == -1) {
|
373
|
+
char buf[200];
|
374
|
+
snprintf (buf, sizeof(buf)-1, "unable to get sock name: %s", strerror(errno));
|
375
|
+
throw std::runtime_error (buf);
|
376
|
+
}
|
377
|
+
|
378
|
+
return true;
|
379
|
+
}
|
380
|
+
|
381
|
+
|
343
382
|
/*********************************************
|
344
383
|
EventableDescriptor::GetPendingConnectTimeout
|
345
384
|
*********************************************/
|
@@ -1628,23 +1667,6 @@ void AcceptorDescriptor::Heartbeat()
|
|
1628
1667
|
}
|
1629
1668
|
|
1630
1669
|
|
1631
|
-
/*******************************
|
1632
|
-
AcceptorDescriptor::GetSockname
|
1633
|
-
*******************************/
|
1634
|
-
|
1635
|
-
bool AcceptorDescriptor::GetSockname (struct sockaddr *s, socklen_t *len)
|
1636
|
-
{
|
1637
|
-
bool ok = false;
|
1638
|
-
if (s) {
|
1639
|
-
int gp = getsockname (GetSocket(), s, len);
|
1640
|
-
if (gp == 0)
|
1641
|
-
ok = true;
|
1642
|
-
}
|
1643
|
-
return ok;
|
1644
|
-
}
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
1670
|
/**************************************
|
1649
1671
|
DatagramDescriptor::DatagramDescriptor
|
1650
1672
|
**************************************/
|
@@ -1922,7 +1944,7 @@ int DatagramDescriptor::SendOutboundDatagram (const char *data, unsigned long le
|
|
1922
1944
|
|
1923
1945
|
struct sockaddr_in6 addr_here;
|
1924
1946
|
size_t addr_here_len = sizeof addr_here;
|
1925
|
-
if (
|
1947
|
+
if (0 != EventMachine_t::name2address (address, port, (struct sockaddr *)&addr_here, &addr_here_len))
|
1926
1948
|
return -1;
|
1927
1949
|
|
1928
1950
|
if (!data && (length > 0))
|
@@ -1950,37 +1972,6 @@ int DatagramDescriptor::SendOutboundDatagram (const char *data, unsigned long le
|
|
1950
1972
|
}
|
1951
1973
|
|
1952
1974
|
|
1953
|
-
/*********************************
|
1954
|
-
ConnectionDescriptor::GetPeername
|
1955
|
-
*********************************/
|
1956
|
-
|
1957
|
-
bool ConnectionDescriptor::GetPeername (struct sockaddr *s, socklen_t *len)
|
1958
|
-
{
|
1959
|
-
bool ok = false;
|
1960
|
-
if (s) {
|
1961
|
-
int gp = getpeername (GetSocket(), s, len);
|
1962
|
-
if (gp == 0)
|
1963
|
-
ok = true;
|
1964
|
-
}
|
1965
|
-
return ok;
|
1966
|
-
}
|
1967
|
-
|
1968
|
-
/*********************************
|
1969
|
-
ConnectionDescriptor::GetSockname
|
1970
|
-
*********************************/
|
1971
|
-
|
1972
|
-
bool ConnectionDescriptor::GetSockname (struct sockaddr *s, socklen_t *len)
|
1973
|
-
{
|
1974
|
-
bool ok = false;
|
1975
|
-
if (s) {
|
1976
|
-
int gp = getsockname (GetSocket(), s, len);
|
1977
|
-
if (gp == 0)
|
1978
|
-
ok = true;
|
1979
|
-
}
|
1980
|
-
return ok;
|
1981
|
-
}
|
1982
|
-
|
1983
|
-
|
1984
1975
|
/**********************************************
|
1985
1976
|
ConnectionDescriptor::GetCommInactivityTimeout
|
1986
1977
|
**********************************************/
|
@@ -2018,22 +2009,6 @@ bool DatagramDescriptor::GetPeername (struct sockaddr *s, socklen_t *len)
|
|
2018
2009
|
return ok;
|
2019
2010
|
}
|
2020
2011
|
|
2021
|
-
/*******************************
|
2022
|
-
DatagramDescriptor::GetSockname
|
2023
|
-
*******************************/
|
2024
|
-
|
2025
|
-
bool DatagramDescriptor::GetSockname (struct sockaddr *s, socklen_t *len)
|
2026
|
-
{
|
2027
|
-
bool ok = false;
|
2028
|
-
if (s) {
|
2029
|
-
int gp = getsockname (GetSocket(), s, len);
|
2030
|
-
if (gp == 0)
|
2031
|
-
ok = true;
|
2032
|
-
}
|
2033
|
-
return ok;
|
2034
|
-
}
|
2035
|
-
|
2036
|
-
|
2037
2012
|
|
2038
2013
|
/********************************************
|
2039
2014
|
DatagramDescriptor::GetCommInactivityTimeout
|
data/ext/ed.h
CHANGED
@@ -64,8 +64,8 @@ class EventableDescriptor: public Bindable_t
|
|
64
64
|
|
65
65
|
void SetEventCallback (EMCallback);
|
66
66
|
|
67
|
-
virtual bool GetPeername (struct sockaddr*, socklen_t*)
|
68
|
-
virtual bool GetSockname (struct sockaddr*, socklen_t*)
|
67
|
+
virtual bool GetPeername (struct sockaddr*, socklen_t*) = 0;
|
68
|
+
virtual bool GetSockname (struct sockaddr*, socklen_t*) = 0;
|
69
69
|
virtual bool GetSubprocessPid (pid_t*) {return false;}
|
70
70
|
|
71
71
|
virtual void StartTls() {}
|
@@ -117,7 +117,9 @@ class EventableDescriptor: public Bindable_t
|
|
117
117
|
bool bWatchOnly;
|
118
118
|
|
119
119
|
EMCallback EventCallback;
|
120
|
-
void _GenericInboundDispatch(const char *buffer, unsigned long size);
|
120
|
+
void _GenericInboundDispatch (const char *buffer, unsigned long size);
|
121
|
+
bool _GenericGetPeername (struct sockaddr*, socklen_t*);
|
122
|
+
bool _GenericGetSockname (struct sockaddr*, socklen_t*);
|
121
123
|
|
122
124
|
uint64_t CreatedAt;
|
123
125
|
bool bCallbackUnbind;
|
@@ -164,6 +166,9 @@ class LoopbreakDescriptor: public EventableDescriptor
|
|
164
166
|
|
165
167
|
virtual bool SelectForRead() {return true;}
|
166
168
|
virtual bool SelectForWrite() {return false;}
|
169
|
+
|
170
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len) { return _GenericGetPeername (s, len); }
|
171
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return _GenericGetSockname (s, len); }
|
167
172
|
};
|
168
173
|
|
169
174
|
|
@@ -219,8 +224,8 @@ class ConnectionDescriptor: public EventableDescriptor
|
|
219
224
|
|
220
225
|
void SetServerMode() {bIsServer = true;}
|
221
226
|
|
222
|
-
virtual bool GetPeername (struct sockaddr
|
223
|
-
virtual bool GetSockname (struct sockaddr
|
227
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len) { return _GenericGetPeername (s, len); }
|
228
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return _GenericGetSockname (s, len); }
|
224
229
|
|
225
230
|
virtual uint64_t GetCommInactivityTimeout();
|
226
231
|
virtual int SetCommInactivityTimeout (uint64_t value);
|
@@ -305,8 +310,8 @@ class DatagramDescriptor: public EventableDescriptor
|
|
305
310
|
// Do we have any data to write? This is used by ShouldDelete.
|
306
311
|
virtual int GetOutboundDataSize() {return OutboundDataSize;}
|
307
312
|
|
308
|
-
virtual bool GetPeername (struct sockaddr
|
309
|
-
virtual bool GetSockname (struct sockaddr
|
313
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len);
|
314
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return _GenericGetSockname (s, len); };
|
310
315
|
|
311
316
|
virtual uint64_t GetCommInactivityTimeout();
|
312
317
|
virtual int SetCommInactivityTimeout (uint64_t value);
|
@@ -345,7 +350,8 @@ class AcceptorDescriptor: public EventableDescriptor
|
|
345
350
|
virtual bool SelectForRead() {return true;}
|
346
351
|
virtual bool SelectForWrite() {return false;}
|
347
352
|
|
348
|
-
virtual bool
|
353
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len) { return _GenericGetPeername (s, len); }
|
354
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return _GenericGetSockname (s, len); };
|
349
355
|
|
350
356
|
static void StopAcceptor (const uintptr_t binding);
|
351
357
|
};
|
@@ -371,6 +377,9 @@ class PipeDescriptor: public EventableDescriptor
|
|
371
377
|
int SendOutboundData (const char*, unsigned long);
|
372
378
|
virtual int GetOutboundDataSize() {return OutboundDataSize;}
|
373
379
|
|
380
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len) { return _GenericGetPeername (s, len); }
|
381
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return _GenericGetSockname (s, len); }
|
382
|
+
|
374
383
|
virtual bool GetSubprocessPid (pid_t*);
|
375
384
|
|
376
385
|
protected:
|
@@ -413,6 +422,9 @@ class KeyboardDescriptor: public EventableDescriptor
|
|
413
422
|
virtual bool SelectForRead() {return true;}
|
414
423
|
virtual bool SelectForWrite() {return false;}
|
415
424
|
|
425
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len) { return _GenericGetPeername (s, len); }
|
426
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return _GenericGetSockname (s, len); }
|
427
|
+
|
416
428
|
protected:
|
417
429
|
bool bReadAttemptedAfterClose;
|
418
430
|
|
@@ -437,6 +449,9 @@ class InotifyDescriptor: public EventableDescriptor
|
|
437
449
|
virtual void Heartbeat() {}
|
438
450
|
virtual bool SelectForRead() {return true;}
|
439
451
|
virtual bool SelectForWrite() {return false;}
|
452
|
+
|
453
|
+
virtual bool GetPeername (struct sockaddr* s, socklen_t* len) { return false; }
|
454
|
+
virtual bool GetSockname (struct sockaddr* s, socklen_t* len) { return false; }
|
440
455
|
};
|
441
456
|
|
442
457
|
#endif // __EventableDescriptor__H_
|
data/ext/em.cpp
CHANGED
@@ -217,7 +217,7 @@ void EventMachine_t::ScheduleHalt()
|
|
217
217
|
|
218
218
|
bool EventMachine_t::Stopping()
|
219
219
|
{
|
220
|
-
|
220
|
+
return bTerminateSignalReceived;
|
221
221
|
}
|
222
222
|
|
223
223
|
/*******************************
|
@@ -1194,9 +1194,10 @@ const uintptr_t EventMachine_t::ConnectToServer (const char *bind_addr, int bind
|
|
1194
1194
|
|
1195
1195
|
struct sockaddr_storage bind_as;
|
1196
1196
|
size_t bind_as_len = sizeof bind_as;
|
1197
|
-
|
1197
|
+
int gai = name2address (server, port, (struct sockaddr *)&bind_as, &bind_as_len);
|
1198
|
+
if (gai != 0) {
|
1198
1199
|
char buf [200];
|
1199
|
-
snprintf (buf, sizeof(buf)-1, "unable to resolve
|
1200
|
+
snprintf (buf, sizeof(buf)-1, "unable to resolve address: %s", gai_strerror(gai));
|
1200
1201
|
throw std::runtime_error (buf);
|
1201
1202
|
}
|
1202
1203
|
|
@@ -1222,9 +1223,12 @@ const uintptr_t EventMachine_t::ConnectToServer (const char *bind_addr, int bind
|
|
1222
1223
|
if (bind_addr) {
|
1223
1224
|
struct sockaddr_storage bind_to;
|
1224
1225
|
size_t bind_to_len = sizeof bind_to;
|
1225
|
-
|
1226
|
+
gai = name2address (bind_addr, bind_port, (struct sockaddr *)&bind_to, &bind_to_len);
|
1227
|
+
if (gai != 0) {
|
1226
1228
|
close (sd);
|
1227
|
-
|
1229
|
+
char buf [200];
|
1230
|
+
snprintf (buf, sizeof(buf)-1, "invalid bind address: %s", gai_strerror(gai));
|
1231
|
+
throw std::runtime_error (buf);
|
1228
1232
|
}
|
1229
1233
|
if (bind (sd, (struct sockaddr *)&bind_to, bind_to_len) < 0) {
|
1230
1234
|
close (sd);
|
@@ -1539,7 +1543,7 @@ int EventMachine_t::DetachFD (EventableDescriptor *ed)
|
|
1539
1543
|
name2address
|
1540
1544
|
************/
|
1541
1545
|
|
1542
|
-
|
1546
|
+
int EventMachine_t::name2address (const char *server, int port, struct sockaddr *addr, size_t *addr_len)
|
1543
1547
|
{
|
1544
1548
|
if (!server || !*server)
|
1545
1549
|
server = "0.0.0.0";
|
@@ -1553,16 +1557,15 @@ bool EventMachine_t::name2address (const char *server, int port, struct sockaddr
|
|
1553
1557
|
char portstr[12];
|
1554
1558
|
snprintf(portstr, sizeof(portstr), "%u", port);
|
1555
1559
|
|
1556
|
-
|
1560
|
+
int gai = getaddrinfo (server, portstr, &hints, &ai);
|
1561
|
+
if (gai == 0) {
|
1557
1562
|
assert (ai->ai_addrlen <= *addr_len);
|
1558
1563
|
memcpy (addr, ai->ai_addr, ai->ai_addrlen);
|
1559
1564
|
*addr_len = ai->ai_addrlen;
|
1560
|
-
|
1561
1565
|
freeaddrinfo(ai);
|
1562
|
-
return true;
|
1563
1566
|
}
|
1564
1567
|
|
1565
|
-
return
|
1568
|
+
return gai;
|
1566
1569
|
}
|
1567
1570
|
|
1568
1571
|
|
@@ -1581,7 +1584,7 @@ const uintptr_t EventMachine_t::CreateTcpServer (const char *server, int port)
|
|
1581
1584
|
|
1582
1585
|
struct sockaddr_storage bind_here;
|
1583
1586
|
size_t bind_here_len = sizeof bind_here;
|
1584
|
-
if (
|
1587
|
+
if (0 != name2address (server, port, (struct sockaddr *)&bind_here, &bind_here_len))
|
1585
1588
|
return 0;
|
1586
1589
|
|
1587
1590
|
SOCKET sd_accept = EmSocket (bind_here.ss_family, SOCK_STREAM, 0);
|
@@ -1636,7 +1639,7 @@ const uintptr_t EventMachine_t::OpenDatagramSocket (const char *address, int por
|
|
1636
1639
|
|
1637
1640
|
struct sockaddr_storage bind_here;
|
1638
1641
|
size_t bind_here_len = sizeof bind_here;
|
1639
|
-
if (
|
1642
|
+
if (0 != name2address (address, port, (struct sockaddr *)&bind_here, &bind_here_len))
|
1640
1643
|
return 0;
|
1641
1644
|
|
1642
1645
|
// from here on, early returns must close the socket!
|
@@ -1889,6 +1892,14 @@ void EventMachine_t::Deregister (EventableDescriptor *ed)
|
|
1889
1892
|
ModifiedDescriptors.erase(ed);
|
1890
1893
|
}
|
1891
1894
|
#endif
|
1895
|
+
|
1896
|
+
#ifdef HAVE_KQUEUE
|
1897
|
+
if (Poller == Poller_Kqueue) {
|
1898
|
+
assert (ed->GetSocket() != INVALID_SOCKET);
|
1899
|
+
|
1900
|
+
ModifiedDescriptors.erase(ed);
|
1901
|
+
}
|
1902
|
+
#endif
|
1892
1903
|
}
|
1893
1904
|
|
1894
1905
|
|
data/ext/em.h
CHANGED
@@ -201,7 +201,7 @@ class EventMachine_t
|
|
201
201
|
|
202
202
|
Poller_t GetPoller() { return Poller; }
|
203
203
|
|
204
|
-
static
|
204
|
+
static int name2address (const char *server, int port, struct sockaddr *addr, size_t *addr_len);
|
205
205
|
|
206
206
|
private:
|
207
207
|
void _RunTimers();
|
data/ext/rubymain.cpp
CHANGED
@@ -472,8 +472,12 @@ static VALUE t_get_peername (VALUE self UNUSED, VALUE signature)
|
|
472
472
|
{
|
473
473
|
char buf[1024];
|
474
474
|
socklen_t len = sizeof buf;
|
475
|
-
|
476
|
-
|
475
|
+
try {
|
476
|
+
if (evma_get_peername (NUM2BSIG (signature), (struct sockaddr*)buf, &len)) {
|
477
|
+
return rb_str_new (buf, len);
|
478
|
+
}
|
479
|
+
} catch (std::runtime_error e) {
|
480
|
+
rb_raise (rb_eRuntimeError, "%s", e.what());
|
477
481
|
}
|
478
482
|
|
479
483
|
return Qnil;
|
@@ -487,8 +491,12 @@ static VALUE t_get_sockname (VALUE self UNUSED, VALUE signature)
|
|
487
491
|
{
|
488
492
|
char buf[1024];
|
489
493
|
socklen_t len = sizeof buf;
|
490
|
-
|
491
|
-
|
494
|
+
try {
|
495
|
+
if (evma_get_sockname (NUM2BSIG (signature), (struct sockaddr*)buf, &len)) {
|
496
|
+
return rb_str_new (buf, len);
|
497
|
+
}
|
498
|
+
} catch (std::runtime_error e) {
|
499
|
+
rb_raise (rb_eRuntimeError, "%s", e.what());
|
492
500
|
}
|
493
501
|
|
494
502
|
return Qnil;
|
@@ -534,7 +542,7 @@ static VALUE t_get_subprocess_status (VALUE self UNUSED, VALUE signature)
|
|
534
542
|
rb_iv_set(proc_status, "@status", INT2FIX(WEXITSTATUS(status)));
|
535
543
|
} else if (WIFSIGNALED(status)) {
|
536
544
|
rb_iv_set(proc_status, "@termsig", INT2FIX(WTERMSIG(status)));
|
537
|
-
} else if (WIFSTOPPED(status)){
|
545
|
+
} else if (WIFSTOPPED(status)) {
|
538
546
|
rb_iv_set(proc_status, "@stopsig", INT2FIX(WSTOPSIG(status)));
|
539
547
|
}
|
540
548
|
#endif
|
@@ -1158,15 +1166,11 @@ t_stopping
|
|
1158
1166
|
|
1159
1167
|
static VALUE t_stopping ()
|
1160
1168
|
{
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
{
|
1167
|
-
return Qfalse;
|
1168
|
-
}
|
1169
|
-
|
1169
|
+
if (evma_stopping()) {
|
1170
|
+
return Qtrue;
|
1171
|
+
} else {
|
1172
|
+
return Qfalse;
|
1173
|
+
}
|
1170
1174
|
}
|
1171
1175
|
|
1172
1176
|
|
@@ -1490,7 +1494,7 @@ extern "C" void Init_rubyeventmachine()
|
|
1490
1494
|
rb_define_const (EmModule, "ConnectionNotifyReadable", INT2NUM(EM_CONNECTION_NOTIFY_READABLE));
|
1491
1495
|
rb_define_const (EmModule, "ConnectionNotifyWritable", INT2NUM(EM_CONNECTION_NOTIFY_WRITABLE));
|
1492
1496
|
rb_define_const (EmModule, "SslHandshakeCompleted", INT2NUM(EM_SSL_HANDSHAKE_COMPLETED ));
|
1493
|
-
|
1497
|
+
rb_define_const (EmModule, "SslVerify", INT2NUM(EM_SSL_VERIFY ));
|
1494
1498
|
// EM_PROXY_TARGET_UNBOUND = 110,
|
1495
1499
|
// EM_PROXY_COMPLETED = 111
|
1496
1500
|
|