Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated NAN async callback usage #40

Open
joelpurra opened this issue May 13, 2021 · 0 comments
Open

Fix deprecated NAN async callback usage #40

joelpurra opened this issue May 13, 2021 · 0 comments

Comments

@joelpurra
Copy link
Collaborator

joelpurra commented May 13, 2021

Deprecation warnings (since Node.js v10):

  • Nan::MakeCallback(...)
  • Call(...) on Nan::Callback

Should either use/pass in Nan::AsyncResource, or switch to Nan::AsyncWorker (which builds upon Nan::AsyncResource).

The effect on asynchronous DNS requests should be assessed, and possibly improved. This change may help with cleanup of both finished and unfinished requests.

See

../src/GNContext.cpp: In static member function ‘static void GNContext::Callback(getdns_context*, getdns_callback_type_t, getdns_dict*, void*, getdns_transaction_t)’:
../src/GNContext.cpp:832:69: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
  832 |     data->callback->Call(Nan::GetCurrentContext()->Global(), 3, argv);
      |                                                                     ^
In file included from ../src/GNContext.h:32,
                 from ../src/GNContext.cpp:28:
../node_modules/nan/nan.h:1720:3: note: declared here
 1720 |   Call(v8::Local<v8::Object> target
      |   ^~~~
../src/GNContext.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE GNContext::Lookup(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/GNContext.cpp:877:81: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  877 |         Nan::MakeCallback(Nan::GetCurrentContext()->Global(), localCb, 1, cbArgs);
      |                                                                                 ^
In file included from ../src/GNContext.h:32,
                 from ../src/GNContext.cpp:28:
../node_modules/nan/nan.h:1026:46: note: declared here
 1026 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
      |                                              ^~~~~~~~~~~~
../src/GNContext.cpp:886:81: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  886 |         Nan::MakeCallback(Nan::GetCurrentContext()->Global(), localCb, 1, cbArgs);
      |                                                                                 ^
In file included from ../src/GNContext.h:32,
                 from ../src/GNContext.cpp:28:
../node_modules/nan/nan.h:1026:46: note: declared here
 1026 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
      |                                              ^~~~~~~~~~~~
../src/GNContext.cpp:916:81: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  916 |         Nan::MakeCallback(Nan::GetCurrentContext()->Global(), localCb, 1, cbArgs);
      |                                                                                 ^
In file included from ../src/GNContext.h:32,
                 from ../src/GNContext.cpp:28:
../node_modules/nan/nan.h:1026:46: note: declared here
 1026 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
      |                                              ^~~~~~~~~~~~
../src/GNContext.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE GNContext::HelperLookup(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/GNContext.cpp:992:81: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
  992 |         Nan::MakeCallback(Nan::GetCurrentContext()->Global(), localCb, 1, cbArgs);
      |                                                                                 ^
In file included from ../src/GNContext.h:32,
                 from ../src/GNContext.cpp:28:
../node_modules/nan/nan.h:1026:46: note: declared here
 1026 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
      |                                              ^~~~~~~~~~~~
In file included from ../src/GNContext.h:31,
                 from ../src/GNContext.cpp:28:
../src/GNContext.cpp: At global scope:
@joelpurra joelpurra changed the title Fix deprecated NaN usage Fix deprecated NAN async callback usage May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant