back off steps and eaddress in use

stable
Bronwen 2021-02-14 02:03:26 -05:00
parent e02bab2948
commit 71ffc122d6
2 changed files with 21 additions and 5 deletions

View File

@ -39,6 +39,10 @@ class Server extends EventEmitter {
openServer() { openServer() {
log.info(`opening STP server on ${this.port}`); log.info(`opening STP server on ${this.port}`);
this.tcpServer = net.createServer(this.tcpConnectClient.bind(this)); this.tcpServer = net.createServer(this.tcpConnectClient.bind(this));
this.tcpServer.on('error', e => {
log.warn(e)
setTimeout(this.openServer.bind(this), 5000);
})
this.tcpServer.listen(this.port); this.tcpServer.listen(this.port);
} }

View File

@ -39,7 +39,8 @@ function connectNetwork(t = 1000) {
client.on('error', e => { client.on('error', e => {
}); });
client.on('close', e => { client.on('close', e => {
setTimeout(connectNetwork.bind(global, t*2), t); t *= 2;
setTimeout(connectNetwork.bind(global, t), t);
log.debug('retrying connection... ' + (t/1000) + 's') log.debug('retrying connection... ' + (t/1000) + 's')
}); });
} }
@ -52,14 +53,18 @@ const app = express();
app.get('/', (req, res) => { app.get('/', (req, res) => {
res.end(` res.end(`
<style> <style>
html {
background: black;
color: white;
}
td:not(:last-child), th:not(:last-child) { td:not(:last-child), th:not(:last-child) {
border-right: 1px solid black; border-right: 1px solid white;
} }
td, th { td, th {
padding-left: 8px; padding-left: 8px;
} }
th { th {
border-bottom: 3px solid black; border-bottom: 3px solid white;
} }
table { table {
border-spacing: 0px; border-spacing: 0px;
@ -67,7 +72,7 @@ app.get('/', (req, res) => {
font-size: 13px; font-size: 13px;
} }
tr:nth-child(2n) { tr:nth-child(2n) {
background: #ccc; background: #111;
} }
</style> </style>
<table style="min-width: 300px"> <table style="min-width: 300px">
@ -89,7 +94,14 @@ app.get('/', (req, res) => {
// app.post // app.post
app.listen(8080); app.listen(8080).on('error', e => {
log.warn(e);
setTimeout(_ => {
app.listen(8080).on('error', e => {
log.error(e);
});
}, 5000);
});