summaryrefslogtreecommitdiff
path: root/src/netops.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/netops.c')
-rw-r--r--src/netops.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/netops.c b/src/netops.c
index 7d8a7b28c..da242795b 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -23,6 +23,7 @@
#include "common.h"
#include "netops.h"
+#include "posix.h"
void gitno_buffer_setup(gitno_buffer *buf, char *data, unsigned int len, int fd)
{
@@ -138,6 +139,7 @@ int gitno_send(GIT_SOCKET s, const char *msg, size_t len, int flags)
return off;
}
+
#ifdef GIT_WIN32
int gitno_close(GIT_SOCKET s)
{
@@ -150,6 +152,20 @@ int gitno_close(GIT_SOCKET s)
}
#endif
+int gitno_send_chunk_size(int s, size_t len)
+{
+ char str[8] = {0};
+ int ret;
+
+ ret = p_snprintf(str, sizeof(str), "%zx", len);
+ if (ret >= (int) sizeof(str)) {
+ return git__throw(GIT_ESHORTBUFFER, "Your number is too fucking big");
+ }
+
+ return gitno_send(s, str, ret, 0 /* TODO: MSG_MORE */);
+}
+
+
int gitno_select_in(gitno_buffer *buf, long int sec, long int usec)
{
fd_set fds;