Skip to content

Commit b302b04

Browse files
authored
Merge pull request #10 from corollari/patch-1
Fix usage of tls.TLSSocket The constructor of `tls.TLSSocket` requires a net.Socket (see [docs](https://nodejs.org/api/tls.html#tls_new_tls_tlssocket_socket_options)), which doesn't seem to be provided. This PR fixes this by changing the code to fit the node API.
2 parents c1de4f2 + f6df4c2 commit b302b04

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/socket/socket_client_tcp.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const TIMEOUT = 10000
55

66
class SocketClient {
77
constructor(self, host, port, protocol, options) {
8-
let conn
8+
let conn = new net.Socket()
99
switch (protocol) {
1010
case 'tcp':
11-
conn = new net.Socket()
1211
break
1312
case 'tls':
1413
case 'ssl':
@@ -18,7 +17,7 @@ class SocketClient {
1817
} catch (e) {
1918
throw new Error('tls package could not be loaded')
2019
}
21-
conn = new tls.TLSSocket(options)
20+
conn = new tls.TLSSocket(conn, options)
2221
break
2322
default:
2423
throw new Error('not supported protocol', protocol)

0 commit comments

Comments
 (0)