mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-30 22:13:49 +00:00
Refine buffer handling
This commit is contained in:
+12
-16
@@ -33,28 +33,26 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct listen_ctx {
|
||||
typedef struct listen_ctx {
|
||||
ev_io io;
|
||||
int fd;
|
||||
int timeout;
|
||||
int method;
|
||||
char *iface;
|
||||
struct ev_loop *loop;
|
||||
};
|
||||
} listen_ctx_t;
|
||||
|
||||
struct server_ctx {
|
||||
typedef struct server_ctx {
|
||||
ev_io io;
|
||||
ev_timer watcher;
|
||||
int connected;
|
||||
struct server *server;
|
||||
};
|
||||
} server_ctx_t;
|
||||
|
||||
struct server {
|
||||
typedef struct server {
|
||||
int fd;
|
||||
int stage;
|
||||
ssize_t buf_len;
|
||||
ssize_t buf_idx;
|
||||
char *buf; // server send from, remote recv into
|
||||
buffer_t *buf;
|
||||
|
||||
int auth;
|
||||
struct chunk *chunk;
|
||||
@@ -69,22 +67,20 @@ struct server {
|
||||
struct ResolvQuery *query;
|
||||
|
||||
struct cork_dllist_item entries;
|
||||
};
|
||||
} server_t;
|
||||
|
||||
struct remote_ctx {
|
||||
typedef struct remote_ctx {
|
||||
ev_io io;
|
||||
int connected;
|
||||
struct remote *remote;
|
||||
};
|
||||
} remote_ctx_t;
|
||||
|
||||
struct remote {
|
||||
typedef struct remote {
|
||||
int fd;
|
||||
ssize_t buf_len;
|
||||
ssize_t buf_idx;
|
||||
char *buf; // remote send from, server recv into
|
||||
buffer_t *buf;
|
||||
struct remote_ctx *recv_ctx;
|
||||
struct remote_ctx *send_ctx;
|
||||
struct server *server;
|
||||
};
|
||||
} remote_t;
|
||||
|
||||
#endif // _SERVER_H
|
||||
|
||||
Reference in New Issue
Block a user