From 32c0f908cd753f9319909e2f43d2b4657ebaf664 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Sun, 21 Jan 2018 08:44:23 +1100 Subject: Allow the number of incoming connections to be limited It was already possible to limit outgoing connections. One might want to do this on home network connections with high bandwidth but low usage caps. --- src/daemon/command_parser_executor.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/daemon/command_parser_executor.cpp') diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 3ec74ff79..09e425dd1 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -428,6 +428,23 @@ bool t_command_parser_executor::out_peers(const std::vector& args) return m_executor.out_peers(limit); } +bool t_command_parser_executor::in_peers(const std::vector& args) +{ + if (args.empty()) return false; + + unsigned int limit; + try { + limit = std::stoi(args[0]); + } + + catch(const std::exception& ex) { + _erro("stoi exception"); + return false; + } + + return m_executor.in_peers(limit); +} + bool t_command_parser_executor::start_save_graph(const std::vector& args) { if (!args.empty()) return false; -- cgit v1.2.3