(context, current, status, handle, req, readable, writable)
| 1916 | } |
| 1917 | |
| 1918 | function afterConnectMultiple(context, current, status, handle, req, readable, writable) { |
| 1919 | debug('connect/multiple: connection attempt to %s:%s completed with status %s', req.address, req.port, status); |
| 1920 | |
| 1921 | // Make sure another connection is not spawned |
| 1922 | clearTimeout(context[kTimeout]); |
| 1923 | |
| 1924 | // One of the connection has completed and correctly dispatched but after timeout, ignore this one |
| 1925 | if (status === 0 && current !== context.current - 1) { |
| 1926 | debug('connect/multiple: ignoring successful but timedout connection to %s:%s', req.address, req.port); |
| 1927 | handle.close(); |
| 1928 | return; |
| 1929 | } |
| 1930 | |
| 1931 | const self = context.socket; |
| 1932 | |
| 1933 | // Some error occurred, add to the list of exceptions |
| 1934 | if (status !== 0) { |
| 1935 | const ex = createConnectionError(req, status); |
| 1936 | ArrayPrototypePush(context.errors, ex); |
| 1937 | |
| 1938 | self.emit('connectionAttemptFailed', req.address, req.port, req.addressType, ex); |
| 1939 | |
| 1940 | // Try the next address, unless we were aborted |
| 1941 | if (context.socket.connecting) { |
| 1942 | internalConnectMultiple(context, status === UV_ECANCELED); |
| 1943 | } |
| 1944 | |
| 1945 | return; |
| 1946 | } |
| 1947 | |
| 1948 | if (hasObserver('net')) { |
| 1949 | startPerf( |
| 1950 | self, |
| 1951 | kPerfHooksNetConnectContext, |
| 1952 | { type: 'net', name: 'connect', detail: { host: req.address, port: req.port } }, |
| 1953 | ); |
| 1954 | } |
| 1955 | |
| 1956 | afterConnect(status, self._handle, req, readable, writable); |
| 1957 | } |
| 1958 | |
| 1959 | function internalConnectMultipleTimeout(context, req, handle) { |
| 1960 | debug('connect/multiple: connection to %s:%s timed out', req.address, req.port); |
nothing calls this directly
no test coverage detected