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
657ce4b5
Commit
657ce4b5
authored
Oct 01, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http-transport: Properly cleanup the WSA context
parent
1e5b2635
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
src/transport-http.c
+13
-13
No files found.
src/transport-http.c
View file @
657ce4b5
...
@@ -348,10 +348,6 @@ static int http_close(git_transport *transport)
...
@@ -348,10 +348,6 @@ static int http_close(git_transport *transport)
if
(
error
<
0
)
if
(
error
<
0
)
return
git__throw
(
GIT_EOSERR
,
"Failed to close the socket: %s"
,
strerror
(
errno
));
return
git__throw
(
GIT_EOSERR
,
"Failed to close the socket: %s"
,
strerror
(
errno
));
#ifdef GIT_WIN32
WSACleanup
();
#endif
return
GIT_SUCCESS
;
return
GIT_SUCCESS
;
}
}
...
@@ -363,6 +359,14 @@ static void http_free(git_transport *transport)
...
@@ -363,6 +359,14 @@ static void http_free(git_transport *transport)
unsigned
int
i
;
unsigned
int
i
;
git_pkt
*
p
;
git_pkt
*
p
;
#ifdef GIT_WIN32
/* cleanup the WSA context. note that this context
* can be initialized more than once with WSAStartup(),
* and needs to be cleaned one time for each init call
*/
WSACleanup
();
#endif
git_vector_foreach
(
refs
,
i
,
p
)
{
git_vector_foreach
(
refs
,
i
,
p
)
{
git_pkt_free
(
p
);
git_pkt_free
(
p
);
}
}
...
@@ -374,13 +378,9 @@ static void http_free(git_transport *transport)
...
@@ -374,13 +378,9 @@ static void http_free(git_transport *transport)
free
(
t
);
free
(
t
);
}
}
int
git_transport_http
(
git_transport
**
out
)
int
git_transport_http
(
git_transport
**
out
)
{
{
transport_http
*
t
;
transport_http
*
t
;
#ifdef GIT_WIN32
int
ret
;
#endif
t
=
git__malloc
(
sizeof
(
transport_http
));
t
=
git__malloc
(
sizeof
(
transport_http
));
if
(
t
==
NULL
)
if
(
t
==
NULL
)
...
@@ -393,15 +393,15 @@ int git_transport_http(git_transport **out)
...
@@ -393,15 +393,15 @@ int git_transport_http(git_transport **out)
t
->
parent
.
close
=
http_close
;
t
->
parent
.
close
=
http_close
;
t
->
parent
.
free
=
http_free
;
t
->
parent
.
free
=
http_free
;
*
out
=
(
git_transport
*
)
t
;
#ifdef GIT_WIN32
#ifdef GIT_WIN32
ret
=
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
t
->
wsd
);
/* on win32, the WSA context needs to be initialized
if
(
ret
!=
0
)
{
* before any socket calls can be performed */
http_free
(
*
out
);
if
(
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
t
->
wsd
)
!=
0
)
{
http_free
(
t
);
return
git__throw
(
GIT_EOSERR
,
"Winsock init failed"
);
return
git__throw
(
GIT_EOSERR
,
"Winsock init failed"
);
}
}
#endif
#endif
*
out
=
(
git_transport
*
)
t
;
return
GIT_SUCCESS
;
return
GIT_SUCCESS
;
}
}
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