summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--ext/openssl/ossl_ssl.c17
2 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c0d8bb84f3..d992d96dc13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Mar 13 07:01:38 2015 Eric Wong <e@80x24.org>
+
+ * ext/openssl/ossl_ssl.c: predefine wait_*able symbols
+
Thu Mar 12 22:59:53 2015 Tanaka Akira <akr@fsij.org>
* test/lib/leakchecker.rb: Check environment variables.
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 48e97308e3e..496d9483cd1 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -107,7 +107,7 @@ static const char *ossl_ssl_attrs[] = {
ID ID_callback_state;
-static VALUE sym_exception;
+static VALUE sym_exception, sym_wait_readable, sym_wait_writable;
/*
* SSLContext class
@@ -1296,12 +1296,12 @@ ossl_start_ssl(VALUE self, int (*func)(), const char *funcname,
switch((ret2 = ssl_get_error(ssl, ret))){
case SSL_ERROR_WANT_WRITE:
- if (no_exception) { return ID2SYM(rb_intern("wait_writable")); }
+ if (no_exception) { return sym_wait_writable; }
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- if (no_exception) { return ID2SYM(rb_intern("wait_readable")); }
+ if (no_exception) { return sym_wait_readable; }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
@@ -1444,12 +1444,12 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
if (no_exception) { return Qnil; }
rb_eof_error();
case SSL_ERROR_WANT_WRITE:
- if (no_exception) { return ID2SYM(rb_intern("wait_writable")); }
+ if (no_exception) { return sym_wait_writable; }
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- if (no_exception) { return ID2SYM(rb_intern("wait_readable")); }
+ if (no_exception) { return sym_wait_readable; }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
@@ -1532,12 +1532,12 @@ ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock, int no_exception)
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_WANT_WRITE:
- if (no_exception) { return ID2SYM(rb_intern("wait_writable")); }
+ if (no_exception) { return sym_wait_writable; }
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
case SSL_ERROR_WANT_READ:
- if (no_exception) { return ID2SYM(rb_intern("wait_readable")); }
+ if (no_exception) { return sym_wait_readable; }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
@@ -2313,5 +2313,8 @@ Init_ossl_ssl(void)
ossl_ssl_def_const(OP_NETSCAPE_CA_DN_BUG);
ossl_ssl_def_const(OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
+#undef rb_intern
sym_exception = ID2SYM(rb_intern("exception"));
+ sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
+ sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
}