mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-16 16:28:50 +00:00
Merge pull request #78 from cosmicpsyop/feature/freebsd-support-one
feature/freebsd-support-one: main freebsd adjustments
This commit is contained in:
@ -17,6 +17,11 @@
|
||||
|
||||
#include "events.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
enum class PluginEventSifterResult {
|
||||
Accept,
|
||||
|
@ -143,7 +143,7 @@ class WSConnection : NonCopyable {
|
||||
hubTrigger->setData(&asyncCb);
|
||||
|
||||
hubTrigger->start([](uS::Async *a){
|
||||
auto *r = static_cast<std::function<void()> *>(a->data);
|
||||
auto *r = static_cast<std::function<void()> *>(a->getData());
|
||||
(*r)();
|
||||
});
|
||||
|
||||
|
@ -391,7 +391,7 @@ struct Router {
|
||||
hubTrigger->setData(&asyncCb);
|
||||
|
||||
hubTrigger->start([](uS::Async *a){
|
||||
auto *r = static_cast<std::function<void()> *>(a->data);
|
||||
auto *r = static_cast<std::function<void()> *>(a->getData());
|
||||
(*r)();
|
||||
});
|
||||
|
||||
|
@ -223,7 +223,7 @@ void RelayServer::runWebsocket(ThreadPool<MsgWebsocket>::Thread &thr) {
|
||||
hubTrigger->setData(&asyncCb);
|
||||
|
||||
hubTrigger->start([](uS::Async *a){
|
||||
auto *r = static_cast<std::function<void()> *>(a->data);
|
||||
auto *r = static_cast<std::function<void()> *>(a->getData());
|
||||
(*r)();
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
@ -58,9 +58,22 @@ static void setRLimits() {
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &curr)) throw herr("couldn't call getrlimit: ", strerror(errno));
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
LI << "getrlimit NOFILES limit current " << curr.rlim_cur << " with max of " << curr.rlim_max;
|
||||
if (cfg().relay__nofiles > curr.rlim_max) {
|
||||
LI << "Unable to set NOFILES limit to " << cfg().relay__nofiles << ", exceeds max of " << curr.rlim_max;
|
||||
if (curr.rlim_cur < curr.rlim_max) {
|
||||
LI << "Setting NOFILES limit to max of " << curr.rlim_max;
|
||||
curr.rlim_cur = curr.rlim_max;
|
||||
}
|
||||
}
|
||||
else curr.rlim_cur = cfg().relay__nofiles;
|
||||
LI << "setrlimit NOFILES limit to " << curr.rlim_cur;
|
||||
#else
|
||||
if (cfg().relay__nofiles > curr.rlim_max) throw herr("Unable to set NOFILES limit to ", cfg().relay__nofiles, ", exceeds max of ", curr.rlim_max);
|
||||
|
||||
curr.rlim_cur = cfg().relay__nofiles;
|
||||
#endif
|
||||
|
||||
if (setrlimit(RLIMIT_NOFILE, &curr)) throw herr("Failed setting NOFILES limit to ", cfg().relay__nofiles, ": ", strerror(errno));
|
||||
}
|
||||
|
Reference in New Issue
Block a user