mirror of
https://github.com/neovim/neovim.git
synced 2026-08-04 06:38:44 +00:00
- Improve the implementation of deferred/immediate events. - Use the new queue module to change how/when events are queued/processed by giving a private queue to each emitter. - Immediate events(which only exist to break uv_run recursion) are now represented in the `loop->fast_events` queue. - Events pushed to child queues are propagated to the event loop main queue and processed as K_EVENT keys.
40 lines
905 B
C
40 lines
905 B
C
#ifndef NVIM_EVENT_SOCKET_H
|
|
#define NVIM_EVENT_SOCKET_H
|
|
|
|
#include <uv.h>
|
|
|
|
#include "nvim/event/loop.h"
|
|
#include "nvim/event/rstream.h"
|
|
#include "nvim/event/wstream.h"
|
|
|
|
#define ADDRESS_MAX_SIZE 256
|
|
|
|
typedef struct socket_watcher SocketWatcher;
|
|
typedef void (*socket_cb)(SocketWatcher *watcher, int result, void *data);
|
|
typedef void (*socket_close_cb)(SocketWatcher *watcher, void *data);
|
|
|
|
struct socket_watcher {
|
|
// Pipe/socket path, or TCP address string
|
|
char addr[ADDRESS_MAX_SIZE];
|
|
// TCP server or unix socket (named pipe on Windows)
|
|
union {
|
|
struct {
|
|
uv_tcp_t handle;
|
|
struct sockaddr_in addr;
|
|
} tcp;
|
|
struct {
|
|
uv_pipe_t handle;
|
|
} pipe;
|
|
} uv;
|
|
uv_stream_t *stream;
|
|
void *data;
|
|
socket_cb cb;
|
|
socket_close_cb close_cb;
|
|
Queue *events;
|
|
};
|
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
|
# include "event/socket.h.generated.h"
|
|
#endif
|
|
#endif // NVIM_EVENT_SOCKET_H
|