#3242: RemoteSyslogListener: add reusePort option

This commit is contained in:
Günter Obiltschnig
2021-04-14 18:50:30 +02:00
parent cae2f2dea4
commit e4bdfdff0c
4 changed files with 62 additions and 17 deletions

View File

@@ -55,6 +55,13 @@ public:
/// Depending on the address family, the socket
/// will be either an IPv4 or an IPv6 socket.
DatagramSocket(const SocketAddress& address, bool reuseAddress, bool reusePort);
/// Creates a datagram socket and binds it
/// to the given address.
///
/// Depending on the address family, the socket
/// will be either an IPv4 or an IPv6 socket.
DatagramSocket(const Socket& socket);
/// Creates the DatagramSocket with the SocketImpl
/// from another socket. The SocketImpl must be

View File

@@ -63,6 +63,13 @@ public:
/// Creates the RemoteSyslogListener, listening on the given port number
/// and using the number of threads for message processing.
RemoteSyslogListener(Poco::UInt16 port, bool reusePort, int threads);
/// Creates the RemoteSyslogListener, listening on the given port number
/// and using the number of threads for message processing.
///
/// If reusePort is true, the underlying UDP socket will bind
/// with the reusePort flag set.
void setProperty(const std::string& name, const std::string& value);
/// Sets the property with the given value.
///
@@ -70,6 +77,8 @@ public:
/// * port: The UDP port number where to listen for UDP packets
/// containing syslog messages. If 0 is specified, does not
/// listen for UDP messages.
/// * reusePort: If set to true, allows multiple instances
/// binding to the same port number.
/// * threads: The number of parser threads processing
/// received syslog messages. Defaults to 1. A maximum
/// of 16 threads is supported.
@@ -97,6 +106,7 @@ public:
/// Registers the channel with the global LoggingFactory.
static const std::string PROP_PORT;
static const std::string PROP_REUSE_PORT;
static const std::string PROP_THREADS;
static const std::string PROP_BUFFER;
@@ -114,6 +124,7 @@ private:
Poco::ThreadPool _threadPool;
Poco::NotificationQueue _queue;
Poco::UInt16 _port;
bool _reusePort;
int _threads;
int _buffer;
};