File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Open diff view settings
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ const {
3535 ERR_SOCKET_DGRAM_NOT_RUNNING
3636} = errors . codes ;
3737const { Buffer } = require ( 'buffer' ) ;
38- const dns = require ( 'dns' ) ;
3938const util = require ( 'util' ) ;
4039const { isUint8Array } = require ( 'internal/util/types' ) ;
4140const EventEmitter = require ( 'events' ) ;
@@ -47,6 +46,9 @@ const { UV_UDP_REUSEADDR } = process.binding('constants').os;
4746
4847const { UDP , SendWrap } = process . binding ( 'udp_wrap' ) ;
4948
49+ // Lazy load for startup performance.
50+ let dns ;
51+
5052const BIND_STATE_UNBOUND = 0 ;
5153const BIND_STATE_BINDING = 1 ;
5254const BIND_STATE_BOUND = 2 ;
@@ -72,9 +74,10 @@ function lookup6(lookup, address, callback) {
7274
7375
7476function newHandle ( type , lookup ) {
75- if ( lookup === undefined )
77+ if ( lookup === undefined ) {
78+ if ( dns === undefined ) dns = require ( 'dns' ) ;
7679 lookup = dns . lookup ;
77- else if ( typeof lookup !== 'function' )
80+ } else if ( typeof lookup !== 'function' )
7881 throw new ERR_INVALID_ARG_TYPE ( 'lookup' , 'Function' , lookup ) ;
7982
8083 if ( type === 'udp4' ) {
You can’t perform that action at this time.
0 commit comments