Some minor changes
This commit is contained in:
parent
e5a74de831
commit
680b31b4cb
2
github
2
github
@ -1 +1 @@
|
||||
Subproject commit 989bdd62182ba2d4ad040c4177d3ab72eb10e408
|
||||
Subproject commit 279544d0a48ab5236755d6d2ba47d6d23d31f749
|
@ -122,5 +122,5 @@ function deploy_client() {
|
||||
#install_npm
|
||||
#compile_scripts
|
||||
#compile_native
|
||||
#package_client
|
||||
package_client
|
||||
deploy_client
|
||||
|
@ -38,6 +38,8 @@ interface ErrorCodeListener {
|
||||
class ErrorCommandHandler extends AbstractCommandHandler {
|
||||
private readonly handle: ServerConnection;
|
||||
|
||||
private serverType: "teaspeak" | "teamspeak";
|
||||
|
||||
private errorCodeMapping: {[key: string]: ErrorCodeListener} = {};
|
||||
private errorCodeHistory: ErrorCodeListener[] = [];
|
||||
|
||||
@ -46,6 +48,7 @@ class ErrorCommandHandler extends AbstractCommandHandler {
|
||||
constructor(handle: ServerConnection) {
|
||||
super(handle);
|
||||
this.handle = handle;
|
||||
this.serverType = "teaspeak";
|
||||
}
|
||||
|
||||
generateReturnCode(command: string, callback: (result: CommandResult) => void, returnCode?: string) : string {
|
||||
@ -115,6 +118,9 @@ class ErrorCommandHandler extends AbstractCommandHandler {
|
||||
if(command.arguments[0]["teaspeak"] == true) {
|
||||
console.log("Using TeaSpeak identity type");
|
||||
this.handle.handshake_handler().startHandshake();
|
||||
this.serverType = "teaspeak";
|
||||
} else {
|
||||
this.serverType = "teamspeak";
|
||||
}
|
||||
return true;
|
||||
} else if(command.command == "initivexpand2") {
|
||||
@ -128,7 +134,11 @@ class ErrorCommandHandler extends AbstractCommandHandler {
|
||||
clearTimeout(listener.timeout);
|
||||
}
|
||||
|
||||
this.handle.getRtcConnection().doInitialSetup();
|
||||
if(this.serverType === "teaspeak") {
|
||||
this.handle.getRtcConnection().doInitialSetup();
|
||||
} else {
|
||||
this.handle.getRtcConnection().setNotSupported();
|
||||
}
|
||||
this.errorCodeMapping = {};
|
||||
} else if(command.command == "notifyconnectioninforequest") {
|
||||
this.handle.send_command("setconnectioninfo",
|
||||
|
@ -59,7 +59,7 @@ export class Version {
|
||||
}
|
||||
|
||||
isDevelopmentVersion() : boolean {
|
||||
return this.build == 0 && this.major == 0 && this.minor == 0 && this.patch == 0 && this.timestamp == 0;
|
||||
return this.build == 0 && this.major == 0 && this.minor == 0 && this.patch == 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,11 @@ message("Module path: ${CMAKE_MODULE_PATH}")
|
||||
#Setup NodeJS
|
||||
function(setup_nodejs)
|
||||
set(NodeJS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
set(NODEJS_URL "https://atom.io/download/atom-shell")
|
||||
set(NODEJS_VERSION "v8.0.0")
|
||||
#set(NODEJS_URL "https://atom.io/download/atom-shell")
|
||||
#set(NODEJS_VERSION "v8.0.0")
|
||||
|
||||
#set(NODEJS_URL "https://nodejs.org/download/release/")
|
||||
#set(NODEJS_VERSION "v12.13.0")
|
||||
set(NODEJS_URL "https://nodejs.org/download/release/")
|
||||
set(NODEJS_VERSION "v12.13.0")
|
||||
|
||||
find_package(NodeJS REQUIRED)
|
||||
|
||||
|
@ -70,8 +70,8 @@ tc::audio::AudioOutput* global_audio_output;
|
||||
Nan::Set(object, (uint32_t) value, Nan::New<v8::String>(key).ToLocalChecked());
|
||||
|
||||
NAN_MODULE_INIT(init) {
|
||||
logger::initialize_node();
|
||||
//logger::initialize_raw();
|
||||
//logger::initialize_node();
|
||||
logger::initialize_raw();
|
||||
|
||||
#ifndef WIN32
|
||||
logger::info(category::general, tr("Hello World from C. PPID: {}, PID: {}"), getppid(), getpid());
|
||||
|
@ -24,6 +24,7 @@ class Bot {
|
||||
private _timeouts = [];
|
||||
|
||||
reset() {
|
||||
this.connection?.disconnect("reset", () => {});
|
||||
this.connection = undefined;
|
||||
for(const interval of this.switchInterval)
|
||||
clearInterval(interval);
|
||||
@ -31,7 +32,7 @@ class Bot {
|
||||
clearInterval(timeouts);
|
||||
}
|
||||
|
||||
connect() {
|
||||
connect(callbackConnected?: () => void) {
|
||||
this.knwonChannelIds = [];
|
||||
this.client_id = 0;
|
||||
this.initialized = false;
|
||||
@ -42,6 +43,10 @@ class Bot {
|
||||
remote_port: port,
|
||||
remote_host: host,
|
||||
callback: error => {
|
||||
if(callbackConnected) {
|
||||
callbackConnected();
|
||||
}
|
||||
|
||||
if(error == 0) {
|
||||
this.connection.send_command("clientinit", [
|
||||
{
|
||||
@ -95,8 +100,9 @@ class Bot {
|
||||
if(command == "initserver") {
|
||||
this.client_id = parseInt(args[0]["aclid"]);
|
||||
} else if(command == "channellistfinished"){
|
||||
this.disconnect();
|
||||
this.initialized = true;
|
||||
this.switchInterval.push(setInterval(() => this.switch_channel(), 30_000 + Math.random() * 10_000));
|
||||
this.switchInterval.push(setInterval(() => this.switch_channel(), 10_000 + Math.random() * 5_000));
|
||||
} else if(command == "channellist") {
|
||||
for(const element of args) {
|
||||
this.knwonChannelIds.push(parseInt(element["cid"]));
|
||||
@ -121,22 +127,26 @@ class Bot {
|
||||
}
|
||||
|
||||
|
||||
const bot_list: Bot[] = [];
|
||||
const botList: Bot[] = [];
|
||||
|
||||
async function connectBots() {
|
||||
for(let index = 0; index < 5; index++) {
|
||||
for(let index = 0; index < 1 || true; index++) {
|
||||
const bot = new Bot();
|
||||
bot_list.push(bot);
|
||||
bot.connect();
|
||||
botList.push(bot);
|
||||
await new Promise(resolve => bot.connect(resolve));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 10_000));
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
while(botList.length > 50) {
|
||||
const [ bot ] = botList.splice(0, 1);
|
||||
bot.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
bot_list.forEach(connection => {
|
||||
botList.forEach(connection => {
|
||||
if(connection.connection) {
|
||||
connection.connection.send_voice_data(new Uint8Array([1, 2, 3]), 5, false);
|
||||
//connection.connection.send_voice_data(new Uint8Array([1, 2, 3]), 5, false);
|
||||
} else {
|
||||
connection.connect();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user