kgio 2.8.0 → 2.8.0.2.g30c1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13916552988d1efd1b83ba8b1aaf40d0e46cd89b
4
+ data.tar.gz: ed70530a925493064d87fb2cee504940376f77f3
5
+ SHA512:
6
+ metadata.gz: dc7ba745a857a967c5f51ae3d2bacab9d2e44597e4ac14c54d0f857a94b364b2fd70274921698d71657d9e5fcc5fa664a6b06cc67e1399423201ae6f979436ed
7
+ data.tar.gz: fab25c9e18f2f5eb9716acc8167f81df9e0ce990727b097e0e8cd3d74bc16a704131d20a390dcb6f3710ec16459f7605d31346cb7ac72e8a6116f5d44e1421e9
@@ -68,7 +68,7 @@ static VALUE xaccept(void *ptr)
68
68
  int rv;
69
69
 
70
70
  rv = accept_fn(a->fd, a->addr, a->addrlen, a->flags);
71
- if (rv == -1 && errno == ENOSYS && accept_fn != my_accept4) {
71
+ if (rv < 0 && errno == ENOSYS && accept_fn != my_accept4) {
72
72
  accept_fn = my_accept4;
73
73
  rv = accept_fn(a->fd, a->addr, a->addrlen, a->flags);
74
74
  }
@@ -143,7 +143,9 @@ static VALUE in_addr_set(VALUE io, struct sockaddr_storage *addr, socklen_t len)
143
143
  host_len = (long)INET6_ADDRSTRLEN;
144
144
  break;
145
145
  default:
146
- rb_raise(rb_eRuntimeError, "unsupported address family");
146
+ rb_raise(rb_eRuntimeError,
147
+ "unsupported address family: ss_family=%lu (socklen=%ld)",
148
+ (unsigned long)addr->ss_family, (long)len);
147
149
  }
148
150
  host = rb_str_new(NULL, host_len);
149
151
  host_ptr = RSTRING_PTR(host);
@@ -170,7 +172,7 @@ my_accept(struct accept_args *a, int force_nonblock)
170
172
 
171
173
  retry:
172
174
  client_fd = thread_accept(a, force_nonblock);
173
- if (client_fd == -1) {
175
+ if (client_fd < 0) {
174
176
  switch (errno) {
175
177
  case EAGAIN:
176
178
  if (force_nonblock)
@@ -36,7 +36,7 @@ static int my_socket(int domain)
36
36
  retry:
37
37
  fd = socket(domain, MY_SOCK_STREAM, 0);
38
38
 
39
- if (fd == -1) {
39
+ if (fd < 0) {
40
40
  switch (errno) {
41
41
  case EMFILE:
42
42
  case ENFILE:
@@ -53,12 +53,12 @@ retry:
53
53
  goto retry;
54
54
  }
55
55
  }
56
- if (fd == -1)
56
+ if (fd < 0)
57
57
  rb_sys_fail("socket");
58
58
  }
59
59
 
60
60
  if (MY_SOCK_STREAM == SOCK_STREAM) {
61
- if (fcntl(fd, F_SETFL, O_RDWR | O_NONBLOCK) == -1)
61
+ if (fcntl(fd, F_SETFL, O_RDWR | O_NONBLOCK) < 0)
62
62
  close_fail(fd, "fcntl(F_SETFL, O_RDWR | O_NONBLOCK)");
63
63
  rb_fd_fix_cloexec(fd);
64
64
  }
@@ -71,7 +71,7 @@ my_connect(VALUE klass, int io_wait, int domain, void *addr, socklen_t addrlen)
71
71
  {
72
72
  int fd = my_socket(domain);
73
73
 
74
- if (connect(fd, addr, addrlen) == -1) {
74
+ if (connect(fd, addr, addrlen) < 0) {
75
75
  if (errno == EINPROGRESS) {
76
76
  VALUE io = sock_for_fd(klass, fd);
77
77
 
@@ -5,11 +5,15 @@ static void set_nonblocking(int fd)
5
5
  {
6
6
  int flags = fcntl(fd, F_GETFL);
7
7
 
8
+ /*
9
+ * do not check < 0 here, one day we may have enough FD flags
10
+ * to require negative bit
11
+ */
8
12
  if (flags == -1)
9
13
  rb_sys_fail("fcntl(F_GETFL)");
10
14
  if ((flags & O_NONBLOCK) == O_NONBLOCK)
11
15
  return;
12
16
  flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
13
- if (flags == -1)
17
+ if (flags < 0)
14
18
  rb_sys_fail("fcntl(F_SETFL)");
15
19
  }
@@ -109,7 +109,7 @@ static void prepare_read(struct io_args *a, int argc, VALUE *argv, VALUE io)
109
109
 
110
110
  static int read_check(struct io_args *a, long n, const char *msg, int io_wait)
111
111
  {
112
- if (n == -1) {
112
+ if (n < 0) {
113
113
  if (errno == EINTR) {
114
114
  a->fd = my_fileno(a->io);
115
115
  return -1;
@@ -344,7 +344,7 @@ static int write_check(struct io_args *a, long n, const char *msg, int io_wait)
344
344
  if (a->len == n) {
345
345
  done:
346
346
  a->buf = Qnil;
347
- } else if (n == -1) {
347
+ } else if (n < 0) {
348
348
  if (errno == EINTR) {
349
349
  a->fd = my_fileno(a->io);
350
350
  return -1;
@@ -589,7 +589,7 @@ static int writev_check(struct io_args_v *a, long n, const char *msg, int io_wai
589
589
  if (n >= 0) {
590
590
  if (n > 0) a->something_written = 1;
591
591
  return trim_writev_buffer(a, n);
592
- } else if (n == -1) {
592
+ } else if (n < 0) {
593
593
  if (errno == EINTR) {
594
594
  a->fd = my_fileno(a->io);
595
595
  return -1;
@@ -106,7 +106,7 @@ static VALUE s_tryopen(int argc, VALUE *argv, VALUE klass)
106
106
 
107
107
  retry:
108
108
  fd = (int)rb_thread_blocking_region(nogvl_open, &o, RUBY_UBF_IO, 0);
109
- if (fd == -1) {
109
+ if (fd < 0) {
110
110
  if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
111
111
  rb_gc();
112
112
  if (retried)
@@ -114,7 +114,7 @@ retry:
114
114
  retried = 1;
115
115
  goto retry;
116
116
  }
117
- if (fd == -1) {
117
+ if (fd < 0) {
118
118
  int saved_errno = errno;
119
119
 
120
120
  if (!st_lookup(errno2sym, (st_data_t)errno, &rv)) {
metadata CHANGED
@@ -1,23 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kgio
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
5
- prerelease:
4
+ version: 2.8.0.2.g30c1
6
5
  platform: ruby
7
6
  authors:
8
7
  - kgio hackers
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-18 00:00:00.000000000 Z
11
+ date: 2013-08-16 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! 'kgio provides non-blocking I/O methods for Ruby without raising
15
-
13
+ description: |-
14
+ kgio provides non-blocking I/O methods for Ruby without raising
16
15
  exceptions on EAGAIN and EINPROGRESS. It is intended for use with the
17
-
18
16
  Unicorn and Rainbows! Rack servers, but may be used by other
19
-
20
- applications (that run on Unix-like platforms).'
17
+ applications (that run on Unix-like platforms).
21
18
  email: kgio@librelist.org
22
19
  executables: []
23
20
  extensions:
@@ -110,6 +107,7 @@ files:
110
107
  - test/test_unix_server_read_client_write.rb
111
108
  homepage: http://bogomips.org/kgio/
112
109
  licenses: []
110
+ metadata: {}
113
111
  post_install_message:
114
112
  rdoc_options:
115
113
  - -t
@@ -119,47 +117,45 @@ rdoc_options:
119
117
  require_paths:
120
118
  - lib
121
119
  required_ruby_version: !ruby/object:Gem::Requirement
122
- none: false
123
120
  requirements:
124
- - - ! '>='
121
+ - - '>='
125
122
  - !ruby/object:Gem::Version
126
123
  version: '0'
127
124
  required_rubygems_version: !ruby/object:Gem::Requirement
128
- none: false
129
125
  requirements:
130
- - - ! '>='
126
+ - - '>'
131
127
  - !ruby/object:Gem::Version
132
- version: '0'
128
+ version: 1.3.1
133
129
  requirements: []
134
130
  rubyforge_project: rainbows
135
- rubygems_version: 1.8.23
131
+ rubygems_version: 2.0.3
136
132
  signing_key:
137
- specification_version: 3
133
+ specification_version: 4
138
134
  summary: kinder, gentler I/O for Ruby
139
135
  test_files:
140
- - test/test_poll.rb
141
- - test/test_peek.rb
142
- - test/test_socket.rb
143
- - test/test_default_wait.rb
144
- - test/test_no_dns_on_tcp_connect.rb
145
- - test/test_unix_connect.rb
146
- - test/test_pipe_read_write.rb
147
- - test/test_unix_server.rb
148
- - test/test_accept_flags.rb
149
- - test/test_socketpair_read_write.rb
136
+ - test/test_tryopen.rb
150
137
  - test/test_tfo.rb
138
+ - test/test_tcp_server_read_client_write.rb
139
+ - test/test_poll.rb
151
140
  - test/test_tcp_server.rb
152
- - test/test_unix_server_read_client_write.rb
153
- - test/test_cross_thread_close.rb
154
- - test/test_tcp_connect.rb
141
+ - test/test_pipe_popen.rb
142
+ - test/test_unix_server.rb
143
+ - test/test_tcp6_client_read_server_write.rb
144
+ - test/test_kgio_addr.rb
145
+ - test/test_no_dns_on_tcp_connect.rb
146
+ - test/test_peek.rb
155
147
  - test/test_autopush.rb
156
- - test/test_connect_fd_leak.rb
148
+ - test/test_unix_server_read_client_write.rb
157
149
  - test/test_singleton_read_write.rb
158
- - test/test_kgio_addr.rb
159
- - test/test_tryopen.rb
160
- - test/test_tcp6_client_read_server_write.rb
161
- - test/test_tcp_server_read_client_write.rb
150
+ - test/test_tcp_connect.rb
151
+ - test/test_socketpair_read_write.rb
162
152
  - test/test_unix_client_read_server_write.rb
153
+ - test/test_default_wait.rb
163
154
  - test/test_tcp_client_read_server_write.rb
164
- - test/test_pipe_popen.rb
155
+ - test/test_connect_fd_leak.rb
156
+ - test/test_unix_connect.rb
157
+ - test/test_pipe_read_write.rb
158
+ - test/test_accept_flags.rb
159
+ - test/test_socket.rb
165
160
  - test/test_accept_class.rb
161
+ - test/test_cross_thread_close.rb