Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commits (1)
......@@ -237,6 +237,17 @@ function connect_to_server(port) {
else if (!port)
port = Default_Port;
if ( Servers[this.host.toLowerCase()]
|| YLines[this.ircclass].active >= YLines[this.ircclass].maxlinks
) {
this.next_connect = js.setTimeout(
connect_to_server,
YLines[this.ircclass].connfreq * 1000,
this
);
return false;
}
umode_notice(USERMODE_ROUTING,"Routing",format(
"Auto-connecting to %s (%s) on port %d",
this.servername,
......@@ -263,12 +274,6 @@ function handle_outbound_server_connect() {
Unregistered[id] = new Unregistered_Client(id,this);
Unregistered[id].server = true; /* Avoid recvq limitation */
Unregistered[id].ircclass = this.cline.ircclass;
YLines[this.cline.ircclass].active++;
log(LOG_DEBUG,format("Class %s up to %d active out of %d",
this.cline.ircclass,
YLines[this.cline.ircclass].active,
YLines[this.cline.ircclass].maxlinks
));
this.callback_id = this.on("read", Socket_Recv);
} else {
umode_notice(USERMODE_ROUTING,"Routing",format(
......@@ -2836,13 +2841,8 @@ function CLine(host,password,servername,port,ircclass) {
this.port = port;
this.ircclass = ircclass;
this.lastconnect = 0;
if ( YLines[ircclass] !== undefined
&& Servers[servername.toLowerCase()] === undefined
&& YLines[ircclass].connfreq > 0
&& YLines[ircclass].maxlinks > YLines[ircclass].active
) {
if (YLines[ircclass].connfreq > 0)
js.setImmediate(connect_to_server, this);
}
}
function HLine(allowedmask,servername) {
......
......@@ -1294,7 +1294,7 @@ function Server_Quit(str,suppress_bcast,is_netsplit,origin) {
this.netsplit();
}
if (this.socket.outbound) {
if (this.local) {
if (YLines[this.ircclass].active > 0) {
YLines[this.ircclass].active--;
log(LOG_DEBUG, format("Class %s down to %d active out of %d",
......@@ -1305,9 +1305,7 @@ function Server_Quit(str,suppress_bcast,is_netsplit,origin) {
} else {
log(LOG_ERR, format("Class %d YLine going negative", this.ircclass));
}
}
if (this.local) {
this.recvq.purge();
this.sendq.purge();
......
......@@ -186,8 +186,7 @@ function Unregistered_Commands(cmdline) {
break;
}
if (Servers[p[0].toLowerCase()]) {
if (parseInt(p[1]) < 2)
this.quit("Server already exists.");
this.quit("Server already exists.");
return 0;
}
if (parseInt(p[1]) < 2) {
......@@ -199,6 +198,13 @@ function Unregistered_Commands(cmdline) {
this.password
)
) {
if ( YLines[NLines[i].ircclass].maxlinks
&& YLines[NLines[i].ircclass].active
>= YLines[NLines[i].ircclass].maxlinks
) {
this.quit("Too many links on this IRC class.");
return 0;
}
Register_Unregistered_Local_Server(this, p, NLines[i]);
return true;
}
......@@ -214,6 +220,13 @@ function Unregistered_Commands(cmdline) {
if ( (NLines[i].password == this.password)
&& (wildmatch(p[0],NLines[i].servername))
) {
if ( YLines[NLines[i].ircclass].maxlinks
&& YLines[NLines[i].ircclass].active
>= YLines[NLines[i].ircclass].maxlinks
) {
this.quit("Too many links on this IRC class.");
return 0;
}
Register_Unregistered_Local_Server(this, p, NLines[i]);
return true;
}
......@@ -284,18 +297,6 @@ function Unregistered_Quit(msg) {
log(LOG_DEBUG,format("%d clients", server.clients));
else
log(LOG_INFO, format('[UNREG] QUIT ("%s")', msg));
if (this.socket.outbound) {
if (YLines[this.ircclass].active > 0) {
YLines[this.ircclass].active--;
log(LOG_DEBUG, format("Class %d down to %d active out of %d",
this.ircclass,
YLines[this.ircclass].active,
YLines[this.ircclass].maxlinks
));
} else {
log(LOG_ERR, format("Class %d YLine going negative", this.ircclass));
}
}
this.socket.clearOn("read", this.socket.callback_id);
this.socket.close();
log(LOG_NOTICE,format(
......@@ -462,7 +463,7 @@ function Register_Unregistered_Local_Server(unreg, p, nline) {
s.sendq = unreg.sendq;
s.recvq.irc = s;
s.sendq.irc = s;
s.ircclass = unreg.ircclass;
s.ircclass = nline.ircclass;
for (i in HLines) {
if (HLines[i].servername.toLowerCase() == p[0].toLowerCase()) {
......@@ -481,9 +482,15 @@ function Register_Unregistered_Local_Server(unreg, p, nline) {
js.clearInterval(unreg.pinginterval);
s.pinginterval = js.setInterval(
IRCClient_check_timeout,
YLines[unreg.ircclass].pingfreq * 1000,
YLines[s.ircclass].pingfreq * 1000,
s
);
YLines[s.ircclass].active++;
log(LOG_DEBUG,format("Class %s up to %d active out of %d",
s.ircclass,
YLines[s.ircclass].active,
YLines[s.ircclass].maxlinks
));
s.finalize_server_connect("TS");
delete Unregistered[unreg.id];
delete Assigned_IDs[unreg.id];
......