diff --git a/README.md b/README.md index e18c05c..f634582 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,6 @@ as XSane or simple-scan should be able to scan from them. eSCL support in Windows has been introduced in Windows 11 first, but is now available in Windows 10 as well: -Unfortunately, eSCL scanning from Windows seems to be broken as of Nov. 2023. - #### Connecting to an AirSane scanner Go to "Settings"->"Bluetooth & devices"->"Printers and Scanners." There, click "Add Device". diff --git a/web/httpserver.cpp b/web/httpserver.cpp index 1628b1f..e86c143 100644 --- a/web/httpserver.cpp +++ b/web/httpserver.cpp @@ -23,6 +23,7 @@ along with this program. If not, see . #include #include #include +#include #include #ifdef __FreeBSD__ @@ -200,6 +201,7 @@ struct HttpServer::Private std::string mInterfaceName, mUnixSocket; int mInterfaceIndex, mBacklog; AccessFile mAccessFile; + std::mutex mAccessFileMutex; std::atomic mRunning; std::atomic mPipeWriteFd; @@ -374,10 +376,12 @@ struct HttpServer::Private void handleRequest(int fd, Sockaddr address) { + std::unique_lock lock(mAccessFileMutex); if (!mAccessFile.isAllowed(address)) { ::close(fd); return; } + lock.unlock(); fdbuf buf(fd); std::istream is(&buf); @@ -562,6 +566,7 @@ HttpServer::backlog() const HttpServer& HttpServer::applyAccessFile(const AccessFile& file) { + std::lock_guard lock(p->mAccessFileMutex); p->mAccessFile = file; return *this; }