-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remote: don't free transport on disconnect #658
Conversation
Yeah, pretty much. Though I don't see why // Download all of the things
git_remote_download();
// Open fds are bad
git_remote_disconnect();
// My memory is precious, let's free as much as we can
git_remote_free_transport();
// Now let's update the branches
git_remote_upate_tips(); // OH NOES, segfault! And we're back to where we started. |
Yeah, I was undecided. I thought, people might want to reuse the remote object (repeated fetch or something), but that's probably rather uncommon.. Will update. |
I'm not seeing this. Why do we need an explicit |
Currently, git_remote_disconnect not only closes the connection but also frees the underlying transport object, making it impossible to write code like // fetch stuff git_remote_download() // close connection git_remote_disconnect() // call user provided callback for each ref git_remote_update_tips(remote, callback) because remote->refs points to references owned by the transport object. This means, we have an idling connection while running the callback for each reference. Instead, allow immediate disconnect and free the transport later in git_remote_free().
What we do need is to move freeing the transport to
|
Sounds much more reasonable. Let's do it that way. |
Done. |
There we go, 👍 |
remote: don't free transport on disconnect
remote: don't free transport on disconnect
Currently, git_remote_disconnect not only closes the connection but also
frees the underlying transport object, making it impossible to write
code like
because remote->refs points to references owned by the transport object.
This means, we have an idling connection while running the callback for
each reference.
Instead, free the transport later with git_remote_free() or on explicit
call of git_remote_free_transport().
cc @carlosmn: Pretty much what we have talked about. Ack?