fix: Fixes connection closures.
This commit is contained in:
parent
86bf85ccf0
commit
364e268b11
3 changed files with 9 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
if [ ! -d ".tmp" ]; then
|
if [ ! -d ".tmp" ]; then
|
||||||
echo "Hello and welcome to the NextNet (backend) project! Please wait while I initialize things for you..."
|
echo "Please wait while I initialize the backend source for you..."
|
||||||
cp dev.env .env
|
cp dev.env .env
|
||||||
mkdir .tmp
|
mkdir .tmp
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -121,8 +121,7 @@ export class SSHBackendProvider implements BackendBaseClass {
|
||||||
(async() => {
|
(async() => {
|
||||||
await this.sshInstance.forwardIn("0.0.0.0", destPort, (info, accept, reject) => {
|
await this.sshInstance.forwardIn("0.0.0.0", destPort, (info, accept, reject) => {
|
||||||
const foundProxyEntry = this.proxies.find((i) => i.sourceIP == sourceIP && i.sourcePort == sourcePort && i.destPort == destPort);
|
const foundProxyEntry = this.proxies.find((i) => i.sourceIP == sourceIP && i.sourcePort == sourcePort && i.destPort == destPort);
|
||||||
if (!foundProxyEntry) return reject();
|
if (!foundProxyEntry || !foundProxyEntry.enabled) return reject();
|
||||||
if (!foundProxyEntry.enabled) return reject();
|
|
||||||
|
|
||||||
const client: ConnectedClient = {
|
const client: ConnectedClient = {
|
||||||
ip: info.srcIP,
|
ip: info.srcIP,
|
||||||
|
@ -143,11 +142,11 @@ export class SSHBackendProvider implements BackendBaseClass {
|
||||||
// Why is this so confusing
|
// Why is this so confusing
|
||||||
const destConn = accept();
|
const destConn = accept();
|
||||||
|
|
||||||
destConn.on("data", (chunk: Uint8Array) => {
|
destConn.addListener("data", (chunk: Uint8Array) => {
|
||||||
srcConn.write(chunk);
|
srcConn.write(chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
destConn.on("exit", () => {
|
destConn.addListener("close", () => {
|
||||||
this.clients.splice(this.clients.indexOf(client), 1);
|
this.clients.splice(this.clients.indexOf(client), 1);
|
||||||
srcConn.end();
|
srcConn.end();
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.xorg.libXi}/lib
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.xorg.libXi}/lib
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.libGL}/lib
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.libGL}/lib
|
||||||
|
|
||||||
|
if [ ! -d ".tmp" ]; then
|
||||||
|
echo "Hello and welcome to the NextNet project!"
|
||||||
|
mkdir .tmp
|
||||||
|
fi
|
||||||
|
|
||||||
source init.sh
|
source init.sh
|
||||||
'';
|
'';
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue