Skip to content

Commit

Permalink
misc/examples/kemi: use local variable instead of many function calls…
Browse files Browse the repository at this point in the history
… for js
  • Loading branch information
miconda committed Jan 12, 2021
1 parent 6e541fe commit b4f4393
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions misc/examples/kemi/kamailio-basic-kemi-jsdt.js
Expand Up @@ -116,18 +116,19 @@ function ksr_route_relay()
function ksr_route_reqinit()
{
if (!KSR.is_myself_srcip()) {
var srcip = KSR.kx.get_srcip();
if (KSR.htable.sht_match_name("ipban", "eq", srcip) > 0) {
// ip is already blocked
KSR.dbg("request from blocked IP - " + KSR.kx.get_method()
+ " from " + KSR.kx.get_furi() + " (IP:"
+ KSR.kx.get_srcip() + ":" + KSR.kx.get_srcport() + ")\n");
+ srcip + ":" + KSR.kx.get_srcport() + ")\n");
KSR.x.exit();
}
if (KSR.pike.pike_check_req()<0) {
KSR.err("ALERT: pike blocking " + KSR.kx.get_method()
+ " from " + KSR.kx.get_furi() + " (IP:"
+ KSR.kx.get_srcip() + ":" + KSR.kx.get_srcport() + ")\n");
KSR.htable.sht_seti("ipban", KSR.kx.get_srcip(), 1);
+ srcip + ":" + KSR.kx.get_srcport() + ")\n");
KSR.htable.sht_seti("ipban", srcip, 1);
KSR.x.exit();
}
}
Expand Down

0 comments on commit b4f4393

Please sign in to comment.