(type, lookup)
| 29 | } |
| 30 | |
| 31 | function newHandle(type, lookup) { |
| 32 | if (lookup === undefined) { |
| 33 | if (dns === undefined) { |
| 34 | dns = require('dns'); |
| 35 | } |
| 36 | |
| 37 | lookup = dns.lookup; |
| 38 | } else { |
| 39 | validateFunction(lookup, 'lookup'); |
| 40 | } |
| 41 | |
| 42 | if (type === 'udp4') { |
| 43 | const handle = new UDP(); |
| 44 | |
| 45 | handle.lookup = FunctionPrototypeBind(lookup4, handle, lookup); |
| 46 | return handle; |
| 47 | } |
| 48 | |
| 49 | if (type === 'udp6') { |
| 50 | const handle = new UDP(); |
| 51 | |
| 52 | handle.lookup = FunctionPrototypeBind(lookup6, handle, lookup); |
| 53 | handle.bind = handle.bind6; |
| 54 | handle.connect = handle.connect6; |
| 55 | handle.send = handle.send6; |
| 56 | return handle; |
| 57 | } |
| 58 | |
| 59 | throw new ERR_SOCKET_BAD_TYPE(); |
| 60 | } |
| 61 | |
| 62 | |
| 63 | function _createSocketHandle(address, port, addressType, fd, flags) { |
no test coverage detected
searching dependent graphs…