limit max connections to 50

This commit is contained in:
ading2210 2024-02-26 22:52:06 -05:00
parent 582bbd4ecd
commit d79c07e2a4
5 changed files with 6 additions and 8 deletions

View file

@ -28,7 +28,7 @@ EXPORTED_FUNCS="${EXPORTED_FUNCS:1}"
#compile options
RUNTIME_METHODS="addFunction,removeFunction,allocate,ALLOC_NORMAL"
COMPILER_OPTIONS="-o $MODULE_FILE -lcurl -lssl -lcrypto -lcjson -lz -lbrotlidec -lbrotlicommon -lnghttp2 -I $INCLUDE_DIR -L $LIB_DIR"
EMSCRIPTEN_OPTIONS="-lwebsocket.js -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS"
EMSCRIPTEN_OPTIONS="-lwebsocket.js -sENVIRONMENT=worker,web -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sEXPORTED_FUNCTIONS=$EXPORTED_FUNCS -sEXPORTED_RUNTIME_METHODS=$RUNTIME_METHODS"
#clean output dir
rm -rf $OUT_DIR

View file

@ -16,12 +16,8 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (typeof window === "undefined") {
throw new Error("NodeJS is not supported. This only works inside the browser.");
}
//everything is wrapped in a function to prevent emscripten from polluting the global scope
window.libcurl = (function() {
const libcurl = (function() {
//emscripten compiled code is inserted here
/* __emscripten_output__ */

View file

@ -192,6 +192,8 @@ void finish_request(CURLMsg *curl_msg) {
void init_curl() {
curl_global_init(CURL_GLOBAL_DEFAULT);
multi_handle = curl_multi_init();
curl_multi_setopt(multi_handle, CURLMOPT_MAX_TOTAL_CONNECTIONS, 50L);
curl_multi_setopt(multi_handle, CURLMOPT_MAXCONNECTS, 40L);
FILE* file = fopen("/cacert.pem", "wb");
fwrite(_cacert_pem, 1, _cacert_pem_len, file);

View file

@ -1,6 +1,6 @@
{
"name": "libcurl.js",
"version": "0.3.3",
"version": "0.3.4",
"description": "An experimental port of libcurl to WebAssembly for use in the browser.",
"main": "libcurl.mjs",
"scripts": {

@ -1 +1 @@
Subproject commit 65d312414aa896d8f9e18f48e8fe37b72d75ee5c
Subproject commit 3b0d432e89cff7eaa850ba8605b180189e237f1b