Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
4e95ef02
Commit
4e95ef02
authored
Jun 16, 2011
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement and use gitno_send
parent
1b4f8140
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
src/netops.c
+24
-3
src/netops.h
+1
-0
src/transport_git.c
+3
-6
No files found.
src/netops.c
View file @
4e95ef02
...
...
@@ -23,9 +23,15 @@
* Boston, MA 02110-1301, USA.
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#ifndef _MSC_VER
# include <sys/types.h>
# include <sys/socket.h>
# include <netdb.h>
#else
# include <winsock2.h>
# include <Ws2tcpip.h>
# pragma comment(lib, "Ws2_32.lib")
#endif
#include "git2/errors.h"
...
...
@@ -74,3 +80,18 @@ cleanup:
freeaddrinfo
(
info
);
return
error
;
}
int
gitno_send
(
int
s
,
const
char
*
msg
,
int
len
,
int
flags
)
{
int
ret
,
off
=
0
;
while
(
off
<
len
)
{
ret
=
send
(
s
,
msg
+
off
,
len
-
off
,
flags
);
if
(
ret
<
0
)
return
GIT_EOSERR
;
off
+=
ret
;
}
return
off
;
}
src/netops.h
View file @
4e95ef02
...
...
@@ -5,5 +5,6 @@
#define INCLUDE_netops_h__
int
gitno_connect
(
const
char
*
host
,
const
char
*
port
);
int
gitno_send
(
int
s
,
const
char
*
msg
,
int
len
,
int
flags
);
#endif
src/transport_git.c
View file @
4e95ef02
...
...
@@ -91,7 +91,7 @@ static int do_connect(git_priv *priv, const char *url)
int
s
=
-
1
;
char
*
host
,
*
port
,
*
msg
;
const
char
prefix
[]
=
"git://"
;
int
error
,
ret
,
msg_len
,
connected
=
0
;
int
error
,
msg_len
,
connected
=
0
;
if
(
!
git__prefixcmp
(
url
,
prefix
))
url
+=
STRLEN
(
prefix
);
...
...
@@ -104,13 +104,10 @@ static int do_connect(git_priv *priv, const char *url)
if
(
error
<
GIT_SUCCESS
)
goto
cleanup
;
/* FIXME: Do this in a loop */
ret
=
send
(
s
,
msg
,
msg_len
,
0
);
error
=
gitno_send
(
s
,
msg
,
msg_len
,
0
);
free
(
msg
);
if
(
ret
<
0
)
{
error
=
git__throw
(
GIT_EOSERR
,
"Failed to send request"
);
if
(
error
<
GIT_SUCCESS
)
goto
cleanup
;
}
priv
->
socket
=
s
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment