mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-01 15:33:50 +00:00
Refine APIs for auto-blocking
This commit is contained in:
+2
-3
@@ -327,8 +327,7 @@ report_addr(int fd, int err_level)
|
||||
peer_name = get_peer_name(fd);
|
||||
if (peer_name != NULL) {
|
||||
LOGE("failed to handshake with %s", peer_name);
|
||||
// Block all requests from this IP, if the err# exceeds 128.
|
||||
if (check_block_list(peer_name, err_level)) {
|
||||
if (update_block_list(peer_name, err_level)) {
|
||||
LOGE("add %s to block list", peer_name);
|
||||
}
|
||||
}
|
||||
@@ -1499,7 +1498,7 @@ accept_cb(EV_P_ ev_io *w, int revents)
|
||||
in_white_list = 1;
|
||||
}
|
||||
}
|
||||
if (!in_white_list && check_block_list(peer_name, 0)) {
|
||||
if (!in_white_list && check_block_list(peer_name)) {
|
||||
LOGE("block all requests from %s", peer_name);
|
||||
close(serverfd);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user