Skip to content

Commit

Permalink
Drain OpenSSL error queue? Addresses #1719
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Sep 15, 2011
1 parent e06ce75 commit 6312e88
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,22 @@ int Connection::HandleSSLError(const char* func, int rv) {
static char ssl_error_buf[512];
ERR_error_string_n(err, ssl_error_buf, sizeof(ssl_error_buf));

// XXX We need to drain the error queue for this thread or else OpenSSL
// has the possibility of blocking connections? This problem is not well
// understood. And we should be somehow propigating these errors up
// into JavaScript. There is no test which demonstrates this problem.
// https://github.com/joyent/node/issues/1719
while ((err = ERR_get_error()) != 0) {
ERR_error_string_n(err, ssl_error_buf, sizeof(ssl_error_buf));
fprintf(stderr, "(node SSL) %s\n", ssl_error_buf);
}

HandleScope scope;
Local<Value> e = Exception::Error(String::New(ssl_error_buf));
handle_->Set(String::New("error"), e);

DEBUG_PRINT("[%p] SSL: %s failed: (%d:%d) %s\n", ssl_, func, err, rv, ssl_error_buf);
DEBUG_PRINT("[%p] SSL: %s failed: (%d:%d) %s\n", ssl_, func, err, rv,
ssl_error_buf);

return rv;
}
Expand Down

0 comments on commit 6312e88

Please sign in to comment.