| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | protected boolean run() { |
| 29 | if(!run(0, false) || count == 0) { |
| 30 | error(Locking.CONTEXT); |
| 31 | |
| 32 | // kill all sessions with the specified IP (and optional port) |
| 33 | final Sessions ss = context.sessions; |
| 34 | final String arg = args[0]; |
| 35 | for(int s = ss.size() - 1; s >= 0; --s) { |
| 36 | final ClientListener cl = ss.get(s); |
| 37 | final String cs = cl.toString().replaceAll("[]\\[]", ""); |
| 38 | if(cl.context() == context) { |
| 39 | // show error if own session is addressed |
| 40 | if(cs.equals(arg)) return error(KILL_SELF_X, arg); |
| 41 | } else if(cs.startsWith(arg)) { |
| 42 | info(LI + cs); |
| 43 | cl.close(); |
| 44 | count++; |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | return info(SESSIONS_KILLED_X, count); |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | protected boolean run(final String user, final String db) { |