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
e8e490b2
Unverified
Commit
e8e490b2
authored
Feb 28, 2018
by
Edward Thomson
Committed by
GitHub
Feb 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4554 from pks-t/pks/curl-init
curl: initialize and cleanup global curl state
parents
17bef3b8
2022b004
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
src/global.c
+4
-2
src/streams/curl.c
+18
-0
src/streams/curl.h
+1
-0
No files found.
src/global.c
View file @
e8e490b2
...
...
@@ -11,6 +11,7 @@
#include "sysdir.h"
#include "filter.h"
#include "merge_driver.h"
#include "streams/curl.h"
#include "streams/openssl.h"
#include "thread-utils.h"
#include "git2/global.h"
...
...
@@ -23,7 +24,7 @@
git_mutex
git__mwindow_mutex
;
#define MAX_SHUTDOWN_CB
9
#define MAX_SHUTDOWN_CB
10
static
git_global_shutdown_fn
git__shutdown_callbacks
[
MAX_SHUTDOWN_CB
];
static
git_atomic
git__n_shutdown_callbacks
;
...
...
@@ -63,7 +64,8 @@ static int init_common(void)
(
ret
=
git_filter_global_init
())
==
0
&&
(
ret
=
git_merge_driver_global_init
())
==
0
&&
(
ret
=
git_transport_ssh_global_init
())
==
0
&&
(
ret
=
git_openssl_stream_global_init
())
==
0
)
(
ret
=
git_openssl_stream_global_init
())
==
0
&&
(
ret
=
git_curl_stream_global_init
())
==
0
)
ret
=
git_mwindow_global_init
();
GIT_MEMORY_BARRIER
;
...
...
src/streams/curl.c
View file @
e8e490b2
...
...
@@ -14,6 +14,7 @@
#include "stream.h"
#include "git2/transport.h"
#include "buffer.h"
#include "global.h"
#include "vector.h"
#include "proxy.h"
...
...
@@ -38,6 +39,18 @@ typedef struct {
git_cred
*
proxy_cred
;
}
curl_stream
;
int
git_curl_stream_global_init
(
void
)
{
if
(
curl_global_init
(
CURL_GLOBAL_ALL
)
!=
0
)
{
giterr_set
(
GITERR_NET
,
"could not initialize curl"
);
return
-
1
;
}
/* `curl_global_cleanup` is provided by libcurl */
git__on_shutdown
(
curl_global_cleanup
);
return
0
;
}
static
int
seterr_curl
(
curl_stream
*
s
)
{
giterr_set
(
GITERR_NET
,
"curl error: %s
\n
"
,
s
->
curl_error
);
...
...
@@ -353,6 +366,11 @@ int git_curl_stream_new(git_stream **out, const char *host, const char *port)
#include "stream.h"
int
git_curl_stream_global_init
(
void
)
{
return
0
;
}
int
git_curl_stream_new
(
git_stream
**
out
,
const
char
*
host
,
const
char
*
port
)
{
GIT_UNUSED
(
out
);
...
...
src/streams/curl.h
View file @
e8e490b2
...
...
@@ -11,6 +11,7 @@
#include "git2/sys/stream.h"
extern
int
git_curl_stream_global_init
(
void
);
extern
int
git_curl_stream_new
(
git_stream
**
out
,
const
char
*
host
,
const
char
*
port
);
#endif
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