mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Handle #1562 - add udp/tcp extra param to mg_mkpipe()
This commit is contained in:
1 parent
dc486a2aa3
commit
a3d63c095a
11 files changed
+68
-47
No files matched your search
+7
-2
@@ -1821,11 +1821,11 @@ int send(int sock, const void *buf, size_t len, int flags) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static void test_pipe(void) {
|
||||
static void test_pipe_proto(bool is_udp) {
|
||||
struct mg_mgr mgr;
|
||||
int i, sock, done = 0;
|
||||
mg_mgr_init(&mgr);
|
||||
ASSERT((sock = mg_mkpipe(&mgr, eh6, (void *) &done)) >= 0);
|
||||
ASSERT((sock = mg_mkpipe(&mgr, eh6, (void *) &done, is_udp)) >= 0);
|
||||
ASSERT(send(sock, "hi", 2, 0) == 2);
|
||||
for (i = 0; i < 10 && done == 0; i++) mg_mgr_poll(&mgr, 1);
|
||||
ASSERT(done == 1);
|
||||
@@ -1833,6 +1833,11 @@ static void test_pipe(void) {
|
||||
ASSERT(mgr.conns == NULL);
|
||||
}
|
||||
|
||||
static void test_pipe(void) {
|
||||
test_pipe_proto(true);
|
||||
test_pipe_proto(false);
|
||||
}
|
||||
|
||||
static void u1(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
if (ev == MG_EV_CONNECT) {
|
||||
((int *) fn_data)[0] += 1;
|
||||
|
||||
Reference in new issue
Block a user