Permalink
Browse files

crypto: wrap another BIO code with mutexes

  • Loading branch information...
1 parent 98110c0 commit f13fdaf81542bcb9bc61d9ee904739513befdc62 @indutny committed Jun 17, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/node_crypto.cc
View
@@ -1277,7 +1277,9 @@ Handle<Value> Connection::ClearPending(const Arguments& args) {
Connection *ss = Connection::Unwrap(args);
+ uv_mutex_lock(&ss->request_mutex_);
int bytes_pending = BIO_pending(ss->bio_read_);
+ uv_mutex_unlock(&ss->request_mutex_);
return scope.Close(Integer::New(bytes_pending));
}
@@ -1287,7 +1289,9 @@ Handle<Value> Connection::EncPending(const Arguments& args) {
Connection *ss = Connection::Unwrap(args);
+ uv_mutex_lock(&ss->request_mutex_);
int bytes_pending = BIO_pending(ss->bio_write_);
+ uv_mutex_unlock(&ss->request_mutex_);
return scope.Close(Integer::New(bytes_pending));
}

0 comments on commit f13fdaf

Please sign in to comment.