Add buf,len params to mg_mgr_wakeup()

This commit is contained in:
Sergey Lyubka committed 2022-01-19 09:25:01 +00:00
1 parent 4cd830a0bf
commit fe813ee247
9 files changed
+36 -24

No files matched your search

+4 -4
View File
@@ -21,6 +21,10 @@ struct mg_fs {
bool (*mkd)(const char *path); // Create directory
};
extern struct mg_fs mg_fs_posix; // POSIX open/close/read/write/seek
extern struct mg_fs mg_fs_packed; // Packed FS, see examples/complete
extern struct mg_fs mg_fs_fat; // FAT FS
// File descriptor
struct mg_fd {
void *fd;
@@ -32,7 +36,3 @@ void mg_fs_close(struct mg_fd *fd);
char *mg_file_read(struct mg_fs *fs, const char *path, size_t *size);
bool mg_file_write(struct mg_fs *fs, const char *path, const void *, size_t);
bool mg_file_printf(struct mg_fs *fs, const char *path, const char *fmt, ...);
extern struct mg_fs mg_fs_posix; // POSIX open/close/read/write/seek
extern struct mg_fs mg_fs_packed; // Packed FS, see examples/complete
extern struct mg_fs mg_fs_fat; // FAT FS
+1 -1
View File
@@ -76,4 +76,4 @@ bool mg_aton(struct mg_str str, struct mg_addr *addr);
char *mg_ntoa(const struct mg_addr *addr, char *buf, size_t len);
struct mg_connection *mg_mkpipe(struct mg_mgr *, mg_event_handler_t, void *);
void mg_mgr_wakeup(struct mg_connection *pipe);
void mg_mgr_wakeup(struct mg_connection *pipe, const void *buf, size_t len);
+7 -3
View File
@@ -444,13 +444,17 @@ static bool mg_socketpair(SOCKET sp[2], union usa usa[2]) {
return result;
}
void mg_mgr_wakeup(struct mg_connection *c) {
void mg_mgr_wakeup(struct mg_connection *c, const void *buf, size_t len) {
LOG(LL_INFO, ("skt: %p", c->pfn_data));
send((SOCKET) (size_t) c->pfn_data, "\x01", 1, MSG_NONBLOCKING);
send((SOCKET) (size_t) c->pfn_data, (const char *) buf, len, MSG_NONBLOCKING);
}
static void pf1(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_READ) mg_iobuf_free(&c->recv);
if (ev == MG_EV_READ) {
mg_iobuf_free(&c->recv);
} else if (ev == MG_EV_CLOSE) {
closesocket((SOCKET) (size_t) c->pfn_data);
}
(void) ev_data, (void) fn_data;
}