blob: b8e4ece8c76d34b2a880b5915802104cecd9b793 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
diff --git a/src/torrent/connection_manager.cc b/src/torrent/connection_manager.cc
index 27de45e0..2e98054f 100644
--- a/src/torrent/connection_manager.cc
+++ b/src/torrent/connection_manager.cc
@@ -5,6 +5,7 @@
#include "manager.h"
#include "thread_main.h"
#include "net/listen.h"
+#include "net/socket_address.h"
#include "rak/socket_address.h"
#include "torrent/connection_manager.h"
#include "torrent/error.h"
@@ -102,6 +103,12 @@ ConnectionManager::set_proxy_address(const sockaddr* sa) {
uint32_t
ConnectionManager::filter(const sockaddr* sa) {
+ if (!sa_is_any(sa)) {
+ if ((m_block_ipv4 && sa_is_inet(sa)) ||
+ (m_block_ipv6 && sa_is_inet6(sa)))
+ return 0;
+ }
+
if (!m_slot_filter)
return 1;
else
diff --git a/src/torrent/connection_manager.h b/src/torrent/connection_manager.h
index 61962128..85a1cb5e 100644
--- a/src/torrent/connection_manager.h
+++ b/src/torrent/connection_manager.h
@@ -89,7 +89,7 @@ public:
void set_priority(priority_type p) { m_priority = p; }
void set_send_buffer_size(uint32_t s);
void set_receive_buffer_size(uint32_t s);
- void set_encryption_options(uint32_t options);
+ void set_encryption_options(uint32_t options);
// Setting the addresses creates a copy of the address.
const sockaddr* bind_address() const { return m_bindAddress; }
@@ -104,7 +104,7 @@ public:
void set_filter(const slot_filter_type& s) { m_slot_filter = s; }
bool listen_open(port_type begin, port_type end);
- void listen_close();
+ void listen_close();
// Since trackers need our port number, it doesn't get cleared after
// 'listen_close()'. The client may change the reported port number,
|