mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-27 20:59:00 +08:00
MG_ARCH_RTX nits
This commit is contained in:
parent
5458252e4a
commit
0294603dfc
@ -244,6 +244,11 @@ struct mg_connection {
|
|||||||
mg_http_printf_chunk(c, "%s", "bar");
|
mg_http_printf_chunk(c, "%s", "bar");
|
||||||
mg_http_printf_chunk(c, ""); // Don't forget the last empty chunk
|
mg_http_printf_chunk(c, ""); // Don't forget the last empty chunk
|
||||||
```
|
```
|
||||||
|
- On embedded environment, make sure that serving task has enough stack:
|
||||||
|
give it 2k for simple RESTful serving, or 4-8k for complex dynamic/static
|
||||||
|
serving. In certain environments, it is necessary to adjust heap size, too.
|
||||||
|
By default, IO buffer allocation size `MG_IO_SIZE` is 2048: change it to 512
|
||||||
|
to trim run-time per-connection memory consumption.
|
||||||
|
|
||||||
## Build options
|
## Build options
|
||||||
|
|
||||||
|
@ -3543,7 +3543,8 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
|
|||||||
usa[1] = usa[0];
|
usa[1] = usa[0];
|
||||||
|
|
||||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
||||||
bind(sock, &usa[0].sa, len) == 0 && listen(sock, 3) == 0 &&
|
bind(sock, &usa[0].sa, len) == 0 &&
|
||||||
|
listen(sock, MG_SOCK_LISTEN_BACKLOG_SIZE) == 0 &&
|
||||||
getsockname(sock, &usa[0].sa, &len) == 0 &&
|
getsockname(sock, &usa[0].sa, &len) == 0 &&
|
||||||
(sp[0] = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
(sp[0] = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
||||||
connect(sp[0], &usa[0].sa, len) == 0 &&
|
connect(sp[0], &usa[0].sa, len) == 0 &&
|
||||||
|
@ -335,6 +335,8 @@ struct timeval {
|
|||||||
|
|
||||||
#include <rl_net.h>
|
#include <rl_net.h>
|
||||||
|
|
||||||
|
#define MG_IO_SIZE 512
|
||||||
|
#define MG_SOCK_LISTEN_BACKLOG_SIZE 1
|
||||||
#define MG_ENABLE_CUSTOM_MILLIS 1
|
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#define closesocket(x) closesocket(x)
|
#define closesocket(x) closesocket(x)
|
||||||
@ -629,7 +631,7 @@ int sscanf(const char *, const char *, ...);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE
|
#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE
|
||||||
#define MG_SOCK_LISTEN_BACKLOG_SIZE 128
|
#define MG_SOCK_LISTEN_BACKLOG_SIZE 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_DIRSEP
|
#ifndef MG_DIRSEP
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include <rl_net.h>
|
#include <rl_net.h>
|
||||||
|
|
||||||
|
#define MG_IO_SIZE 512
|
||||||
|
#define MG_SOCK_LISTEN_BACKLOG_SIZE 1
|
||||||
#define MG_ENABLE_CUSTOM_MILLIS 1
|
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#define closesocket(x) closesocket(x)
|
#define closesocket(x) closesocket(x)
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE
|
#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE
|
||||||
#define MG_SOCK_LISTEN_BACKLOG_SIZE 128
|
#define MG_SOCK_LISTEN_BACKLOG_SIZE 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MG_DIRSEP
|
#ifndef MG_DIRSEP
|
||||||
|
@ -406,7 +406,8 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
|
|||||||
usa[1] = usa[0];
|
usa[1] = usa[0];
|
||||||
|
|
||||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
||||||
bind(sock, &usa[0].sa, len) == 0 && listen(sock, 3) == 0 &&
|
bind(sock, &usa[0].sa, len) == 0 &&
|
||||||
|
listen(sock, MG_SOCK_LISTEN_BACKLOG_SIZE) == 0 &&
|
||||||
getsockname(sock, &usa[0].sa, &len) == 0 &&
|
getsockname(sock, &usa[0].sa, &len) == 0 &&
|
||||||
(sp[0] = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
(sp[0] = socket(AF_INET, SOCK_STREAM, 0)) != INVALID_SOCKET &&
|
||||||
connect(sp[0], &usa[0].sa, len) == 0 &&
|
connect(sp[0], &usa[0].sa, len) == 0 &&
|
||||||
|
Loading…
Reference in New Issue
Block a user