Skip to content

Commit f6df4c2

Browse files
authored
Fix usage of tls.TLSSocket
1 parent c1de4f2 commit f6df4c2

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)