nio4r 2.3.1-java → 2.5.3-java

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/workflow.yml +43 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +37 -11
  5. data/CHANGES.md +40 -0
  6. data/Gemfile +5 -6
  7. data/README.md +53 -7
  8. data/Rakefile +0 -2
  9. data/examples/echo_server.rb +2 -2
  10. data/ext/libev/Changes +35 -0
  11. data/ext/libev/README +2 -1
  12. data/ext/libev/ev.c +213 -151
  13. data/ext/libev/ev.h +95 -88
  14. data/ext/libev/ev_epoll.c +26 -15
  15. data/ext/libev/ev_kqueue.c +11 -5
  16. data/ext/libev/ev_linuxaio.c +642 -0
  17. data/ext/libev/ev_poll.c +13 -8
  18. data/ext/libev/ev_port.c +5 -2
  19. data/ext/libev/ev_vars.h +14 -3
  20. data/ext/libev/ev_wrap.h +16 -0
  21. data/ext/nio4r/extconf.rb +2 -0
  22. data/ext/nio4r/monitor.c +1 -0
  23. data/ext/nio4r/nio4r.h +1 -1
  24. data/ext/nio4r/org/nio4r/Selector.java +5 -1
  25. data/ext/nio4r/selector.c +5 -5
  26. data/lib/nio.rb +3 -3
  27. data/lib/nio/bytebuffer.rb +4 -0
  28. data/lib/nio/monitor.rb +10 -8
  29. data/lib/nio/selector.rb +3 -1
  30. data/lib/nio/version.rb +1 -1
  31. data/nio4r.gemspec +10 -2
  32. data/{tasks → rakelib}/extension.rake +2 -0
  33. data/{tasks → rakelib}/rspec.rake +0 -0
  34. data/{tasks → rakelib}/rubocop.rake +0 -0
  35. data/spec/nio/acceptables_spec.rb +3 -5
  36. data/spec/nio/bytebuffer_spec.rb +2 -4
  37. data/spec/nio/monitor_spec.rb +2 -2
  38. data/spec/nio/selectables/ssl_socket_spec.rb +50 -20
  39. data/spec/nio/selectables/tcp_socket_spec.rb +23 -17
  40. data/spec/nio/selectables/udp_socket_spec.rb +13 -8
  41. data/spec/nio/selector_spec.rb +34 -16
  42. data/spec/spec_helper.rb +4 -16
  43. data/spec/support/selectable_examples.rb +37 -17
  44. metadata +28 -17
  45. data/.travis.yml +0 -36
  46. data/LICENSE.txt +0 -20
  47. data/appveyor.yml +0 -27
  48. data/ext/libev/README.embed +0 -3
  49. data/ext/libev/test_libev_win32.c +0 -123
@@ -1,36 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
-
5
- before_install:
6
- - gem update --system
7
- - gem --version
8
-
9
- bundler_args: --without development
10
-
11
- branches:
12
- only:
13
- - master
14
-
15
- rvm:
16
- - jruby-9.1.17.0 # latest stable
17
- - 2.2.7
18
- - 2.3.4
19
- - 2.4.1
20
- - 2.5.0
21
- - ruby-head
22
-
23
- env:
24
- global:
25
- - JRUBY_OPTS="--dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
26
- matrix:
27
- - NIO4R_PURE=false
28
- - NIO4R_PURE=true
29
-
30
- matrix:
31
- allow_failures:
32
- - rvm: ruby-head
33
- fast_finish: true
34
-
35
- notifications:
36
- irc: "irc.freenode.org#celluloid"
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011-2018 Tony Arcieri
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,27 +0,0 @@
1
- branches:
2
- only:
3
- - master
4
-
5
- environment:
6
- PATH: C:\Ruby%RUBY_VERSION%\DevKit\mingw\bin;C:\Ruby%RUBY_VERSION%\bin;C:\Ruby%RUBY_VERSION%\DevKit\bin;%PATH%
7
- matrix:
8
- - RUBY_VERSION: "24-x64"
9
- - RUBY_VERSION: "23-x64"
10
- - RUBY_VERSION: "23"
11
- - RUBY_VERSION: "22"
12
-
13
- install:
14
- - SET RAKEOPT=-rdevkit
15
- - ruby -v
16
- - gem -v
17
- - bundle -v
18
- - bundle install
19
-
20
- build: off
21
-
22
- before_build:
23
- - gem update --system
24
-
25
- test_script:
26
- - echo %PATH%
27
- - bundle exec rake spec
@@ -1,3 +0,0 @@
1
- This file is now included in the main libev documentation, see
2
-
3
- http://cvs.schmorp.de/libev/ev.html
@@ -1,123 +0,0 @@
1
- // a single header file is required
2
- #include <ev.h>
3
- #include <stdio.h>
4
- #include <io.h>
5
-
6
- // every watcher type has its own typedef'd struct
7
- // with the name ev_TYPE
8
- ev_io stdin_watcher;
9
- ev_timer timeout_watcher;
10
-
11
- // all watcher callbacks have a similar signature
12
- // this callback is called when data is readable on stdin
13
- static void
14
- stdin_cb (EV_P_ ev_io *w, int revents)
15
- {
16
- puts ("stdin ready or done or something");
17
- // for one-shot events, one must manually stop the watcher
18
- // with its corresponding stop function.
19
- //ev_io_stop (EV_A_ w);
20
-
21
- // this causes all nested ev_loop's to stop iterating
22
- //ev_unloop (EV_A_ EVUNLOOP_ALL);
23
- }
24
-
25
- // another callback, this time for a time-out
26
- static void
27
- timeout_cb (EV_P_ ev_timer *w, int revents)
28
- {
29
- puts ("timeout");
30
- // this causes the innermost ev_loop to stop iterating
31
- ev_unloop (EV_A_ EVUNLOOP_ONE);
32
- }
33
-
34
-
35
-
36
- #include <winsock.h>
37
-
38
- #include <stdlib.h>
39
- #include <iostream>
40
- int get_server_fd()
41
- {
42
-
43
- //----------------------
44
- // Initialize Winsock.
45
- WSADATA wsaData;
46
- int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
47
- if (iResult != NO_ERROR) {
48
- printf("Error at WSAStartup()\n");
49
- return 1;
50
- }
51
-
52
- //----------------------
53
- // Create a SOCKET for listening for
54
- // incoming connection requests.
55
- SOCKET ListenSocket;
56
- ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
57
- if (ListenSocket == INVALID_SOCKET) {
58
- printf("Error at socket(): %ld\n", WSAGetLastError());
59
- WSACleanup();
60
- return 1;
61
- }
62
- printf("socket returned %d\n", ListenSocket);
63
-
64
- //----------------------
65
- // The sockaddr_in structure specifies the address family,
66
- // IP address, and port for the socket that is being bound.
67
- sockaddr_in service;
68
- service.sin_family = AF_INET;
69
- service.sin_addr.s_addr = inet_addr("127.0.0.1");
70
- service.sin_port = htons(4444);
71
-
72
- if (bind( ListenSocket,
73
- (SOCKADDR*) &service,
74
- sizeof(service)) == SOCKET_ERROR) {
75
- printf("bind() failed.\n");
76
- closesocket(ListenSocket);
77
- WSACleanup();
78
- return 1;
79
- }
80
-
81
- //----------------------
82
- // Listen for incoming connection requests.
83
- // on the created socket
84
- if (listen( ListenSocket, 1 ) == SOCKET_ERROR) {
85
- printf("Error listening on socket.\n");
86
- closesocket(ListenSocket);
87
- WSACleanup();
88
- return 1;
89
- }
90
-
91
-
92
- printf("sock and osf handle are %d %d, error is \n", ListenSocket, _get_osfhandle (ListenSocket)); // -1 is invalid file handle: http://msdn.microsoft.com/en-us/library/ks2530z6.aspx
93
- printf("err was %d\n", WSAGetLastError());
94
- //----------------------
95
- return ListenSocket;
96
- }
97
-
98
-
99
- int
100
- main (void)
101
- {
102
- struct ev_loop *loopy = ev_default_loop(0);
103
- int fd = get_server_fd();
104
- int fd_real = _open_osfhandle(fd, NULL);
105
- int conv = _get_osfhandle(fd_real);
106
- printf("got server fd %d, loop %d, fd_real %d, that converted %d\n", fd, loopy, fd_real, conv);
107
- // accept(fd, NULL, NULL);
108
- // initialise an io watcher, then start it
109
- // this one will watch for stdin to become readable
110
- ev_io_init (&stdin_watcher, stdin_cb, /*STDIN_FILENO*/ conv, EV_READ);
111
- ev_io_start (loopy, &stdin_watcher);
112
-
113
- // initialise a timer watcher, then start it
114
- // simple non-repeating 5.5 second timeout
115
- //ev_timer_init (&timeout_watcher, timeout_cb, 15.5, 0.);
116
- //ev_timer_start (loopy, &timeout_watcher);
117
- printf("starting loop\n");
118
- // now wait for events to arrive
119
- ev_loop (loopy, 0);
120
-
121
- // unloop was called, so exit
122
- return 0;
123
- }