Skip to content

Commit

Permalink
Merge pull request e2guardian#797 from sunweaver/pr/http-workers-corr…
Browse files Browse the repository at this point in the history
…ect-value-for-32bit-archs

Automatically set correct worker count on 32-bit archs.
  • Loading branch information
philipianpearce authored Feb 12, 2024
2 parents f6957c7 + b8fc536 commit ecd2754
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions configs/e2guardian.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ weightedphrasemode = 2
### TUNING section
###

#httpworkers = 500
#httpworkers = @HTTP_WORKERS@
#
#sets the number of worker threads to use
#
Expand All @@ -1087,7 +1087,7 @@ weightedphrasemode = 2
# On 32-bit systems reduce this to 300 to avoid exceeding the <4GB
# virtual memory limit and on Linux decrease the thread stack size from
# 10MB to 2MB (ulimit -s 2048)
# default 500
# default @HTTP_WORKERS@

#maxcontentfiltersize = 2048
#
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ AC_SUBST(E2CONFFILE)
AC_DEFINE_UNQUOTED([__DATADIR],["${E2DATADIR}"],["Data directory path"])
AC_DEFINE_UNQUOTED(__CONFFILE,"${e2sysconfdir}/${PACKAGE_NAME}.conf","Configure file path")

AC_CHECK_SIZEOF([void *])
if test $ac_cv_sizeof_void_p = 8; then
httpworkers=500
else
httpworkers=300
fi
AC_SUBST([HTTP_WORKERS], [$httpworkers])

AC_CONFIG_FILES([Makefile
data/Makefile
data/languages/Makefile
Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ e2guardian_CPPFLAGS = -D__CONFFILE='"$(E2CONFFILE)"' \
-D__PROXYUSER='"$(E2PROXYUSER)"' \
-D__PROXYGROUP='"$(E2PROXYGROUP)"' \
-D__CONFDIR='"$(E2CONFDIR)"' \
-D__HTTPWORKERS='$(HTTP_WORKERS)' \
$(AM_CPPFLAGS)
e2guardian_SOURCES = String.cpp String.hpp \
FDTunnel.cpp FDTunnel.hpp \
Expand Down
2 changes: 1 addition & 1 deletion src/OptionContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ bool OptionContainer::findProcOptions(ConfigReader &cr)
proc.daemon_group_name = __PROXYGROUP;
}

proc.http_workers = cr.findoptionIWithDefault("httpworkers", 20, 20000, 500);
proc.http_workers = cr.findoptionIWithDefault("httpworkers", 20, 20000, __HTTPWORKERS);

return true;

Expand Down

0 comments on commit ecd2754

Please sign in to comment.