(err, port, handle)
| 1228 | |
| 1229 | |
| 1230 | function checkBindError(err, port, handle) { |
| 1231 | // EADDRINUSE may not be reported until we call listen() or connect(). |
| 1232 | // To complicate matters, a failed bind() followed by listen() or connect() |
| 1233 | // will implicitly bind to a random port. Ergo, check that the socket is |
| 1234 | // bound to the expected port before calling listen() or connect(). |
| 1235 | // |
| 1236 | // FIXME(bnoordhuis) Doesn't work for pipe handles, they don't have a |
| 1237 | // getsockname() method. Non-issue for now, the cluster module doesn't |
| 1238 | // really support pipes anyway. |
| 1239 | if (err === 0 && port > 0 && handle.getsockname) { |
| 1240 | const out = {}; |
| 1241 | err = handle.getsockname(out); |
| 1242 | if (err === 0 && port !== out.port) { |
| 1243 | debug(`checkBindError, bound to ${out.port} instead of ${port}`); |
| 1244 | err = UV_EADDRINUSE; |
| 1245 | } |
| 1246 | } |
| 1247 | return err; |
| 1248 | } |
| 1249 | |
| 1250 | |
| 1251 | function internalConnect( |
no test coverage detected
searching dependent graphs…