11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst dgram = require('dgram'); 51cb0ef41Sopenharmony_ciconst { kStateSymbol } = require('internal/dgram'); 61cb0ef41Sopenharmony_ciconst socket = dgram.createSocket('udp4'); 71cb0ef41Sopenharmony_ciconst { handle } = socket[kStateSymbol]; 81cb0ef41Sopenharmony_ciconst lookup = handle.lookup; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci// Test the scenario where the socket is closed during a bind operation. 111cb0ef41Sopenharmony_cihandle.bind = common.mustNotCall('bind() should not be called.'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cihandle.lookup = common.mustCall(function(address, callback) { 141cb0ef41Sopenharmony_ci socket.close(common.mustCall(() => { 151cb0ef41Sopenharmony_ci lookup.call(this, address, callback); 161cb0ef41Sopenharmony_ci })); 171cb0ef41Sopenharmony_ci}); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_cisocket.bind(common.mustNotCall('Socket should not bind.')); 20