diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2023-05-12 20:48:30 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2023-05-13 16:42:04 +0100 |
commit | 11c89c386c8862f834097cdc5d9ed79634cf00f3 (patch) | |
tree | 4bd24e09ecbdf240534ea4dc518639831e327cf7 /src/libgit2/transports/smart.h | |
parent | 6e4bbf222d8c4babaff90aef40615546c8bc9cde (diff) | |
download | libgit2-11c89c386c8862f834097cdc5d9ed79634cf00f3.tar.gz |
net: move `gitno` buffer to `staticstr`
The `gitno` buffer interface is another layer on top of socket reads.
Abstract it a bit into a "static string" that has `git_str` like
semantics but without heap allocation which moves the actual reading
logic into the socket / stream code, and allows for easier future usage
of a static / stack-allocated `git_str`-like interface.
Diffstat (limited to 'src/libgit2/transports/smart.h')
-rw-r--r-- | src/libgit2/transports/smart.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libgit2/transports/smart.h b/src/libgit2/transports/smart.h index 34e27ea8e..52c7553a1 100644 --- a/src/libgit2/transports/smart.h +++ b/src/libgit2/transports/smart.h @@ -11,12 +11,14 @@ #include "git2.h" #include "vector.h" -#include "netops.h" #include "push.h" #include "str.h" #include "oidarray.h" +#include "staticstr.h" #include "git2/sys/transport.h" +#define GIT_SMART_BUFFER_SIZE 65536 + #define GIT_SIDE_BAND_DATA 1 #define GIT_SIDE_BAND_PROGRESS 2 #define GIT_SIDE_BAND_ERROR 3 @@ -170,8 +172,7 @@ typedef struct { unsigned rpc : 1, have_refs : 1, connected : 1; - gitno_buffer buffer; - char buffer_data[65536]; + git_staticstr_with_size(GIT_SMART_BUFFER_SIZE) buffer; } transport_smart; /* smart_protocol.c */ @@ -192,6 +193,8 @@ int git_smart__download_pack( git_indexer_progress *stats); /* smart.c */ +int git_smart__recv(transport_smart *t); + int git_smart__negotiation_step(git_transport *transport, void *data, size_t len); int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream **out); |