(options: ConnectionOptions)
| 41 | } |
| 42 | |
| 43 | export async function connect(options: ConnectionOptions): Promise<Connection> { |
| 44 | let connection: Connection | null = null; |
| 45 | try { |
| 46 | const socket = await makeSocket(options); |
| 47 | connection = makeConnection(options, socket); |
| 48 | await performInitialHandshake(connection, options); |
| 49 | return connection; |
| 50 | } catch (error) { |
| 51 | connection?.destroy(); |
| 52 | throw error; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | export function makeConnection(options: ConnectionOptions, socket: Stream): Connection { |
| 57 | let ConnectionType = options.connectionType ?? Connection; |
no test coverage detected