Skip to content

Commit 3122eb5

Browse files
committed
Hotwiring sockets....
1 parent 7a57108 commit 3122eb5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

proxy.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ function Pool(poolData){
206206
}
207207
this.active = false;
208208
if (this.ssl){
209-
this.socket = tls.connect(this.port, this.hostname, {rejectUnauthorized: this.allowSelfSignedSSL}, ()=>{
209+
this.socket = tls.connect(this.port, this.hostname, {rejectUnauthorized: this.allowSelfSignedSSL}).on('connect', ()=>{
210210
poolSocket(this.hostname);
211211
}).on('error', (err)=>{
212212
this.connect();
213213
console.warn(`${global.threadName}Socket error from ${this.hostname} ${err}`);
214214
});
215215
} else {
216-
this.socket = net.connect(this.port, this.hostname, ()=>{
216+
this.socket = net.connect(this.port, this.hostname).on('connect', ()=>{
217217
poolSocket(this.hostname);
218218
}).on('error', (err)=>{
219219
this.connect();
@@ -643,13 +643,12 @@ function poolSocket(hostname){
643643
}).on('close', () => {
644644
activePools[pool.hostname].connect();
645645
console.warn(`${global.threadName}Socket closed from ${pool.hostname}`);
646-
}).on('connect', () => {
647-
socket.setKeepAlive(true);
648-
socket.setEncoding('utf8');
649-
console.log(`${global.threadName}connected to pool: ${pool.hostname}`);
650-
pool.login();
651-
setInterval(pool.heartbeat, 30000);
652646
});
647+
socket.setKeepAlive(true);
648+
socket.setEncoding('utf8');
649+
console.log(`${global.threadName}connected to pool: ${pool.hostname}`);
650+
pool.login();
651+
setInterval(pool.heartbeat, 30000);
653652
}
654653

655654
function handlePoolMessage(jsonData, hostname){

0 commit comments

Comments
 (0)