@@ -82,6 +82,8 @@ static Persistent<String> fingerprint_symbol;
8282static Persistent<String> name_symbol;
8383static Persistent<String> version_symbol;
8484static Persistent<String> ext_key_usage_symbol;
85+ static Persistent<String> onhandshakestart_sym;
86+ static Persistent<String> onhandshakedone_sym;
8587
8688static Persistent<FunctionTemplate> secure_context_constructor;
8789
@@ -864,7 +866,7 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
864866 // Call it
865867 Local<Value> ret;
866868 ret = Local<Value>::New (MakeCallback (Context::GetCurrent ()->Global (),
867- callback, 1 , argv));
869+ callback, ARRAY_SIZE (argv) , argv));
868870
869871 // If ret is SecureContext
870872 if (secure_context_constructor->HasInstance (ret)) {
@@ -971,12 +973,18 @@ void Connection::SSLInfoCallback(const SSL *ssl, int where, int ret) {
971973 if (where & SSL_CB_HANDSHAKE_START) {
972974 HandleScope scope;
973975 Connection* c = static_cast <Connection*>(SSL_get_app_data (ssl));
974- MakeCallback (c->handle_ , " onhandshakestart" , 0 , NULL );
976+ if (onhandshakestart_sym.IsEmpty ()) {
977+ onhandshakestart_sym = NODE_PSYMBOL (" onhandshakestart" );
978+ }
979+ MakeCallback (c->handle_ , onhandshakestart_sym, 0 , NULL );
975980 }
976981 if (where & SSL_CB_HANDSHAKE_DONE) {
977982 HandleScope scope;
978983 Connection* c = static_cast <Connection*>(SSL_get_app_data (ssl));
979- MakeCallback (c->handle_ , " onhandshakedone" , 0 , NULL );
984+ if (onhandshakedone_sym.IsEmpty ()) {
985+ onhandshakedone_sym = NODE_PSYMBOL (" onhandshakedone" );
986+ }
987+ MakeCallback (c->handle_ , onhandshakedone_sym, 0 , NULL );
980988 }
981989}
982990
@@ -4117,7 +4125,7 @@ EIO_PBKDF2After(uv_work_t* req) {
41174125
41184126 MakeCallback (Context::GetCurrent ()->Global (),
41194127 request->callback ,
4120- 2 , argv);
4128+ ARRAY_SIZE (argv) , argv);
41214129
41224130 delete[] request->pass ;
41234131 delete[] request->salt ;
@@ -4307,7 +4315,7 @@ void RandomBytesAfter(uv_work_t* work_req) {
43074315
43084316 MakeCallback (Context::GetCurrent ()->Global (),
43094317 req->callback_ ,
4310- 2 , argv);
4318+ ARRAY_SIZE (argv) , argv);
43114319
43124320 delete req;
43134321}
0 commit comments