git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] http-push: remove remote locks on exit signals
@ 2008-05-22 19:55 Clemens Buchacher
  2008-05-23 21:40 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Clemens Buchacher @ 2008-05-22 19:55 UTC (permalink / raw)
  To: git

If locks are not cleaned up the repository is inaccessible for 10 minutes.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---

Hi,

To test this I created a large file, added it, commited, pushed, waited one
second and pressed Ctrl+C. If this method is acceptable for the regression
tests, or if you have a better idea, let me know. I will write up a script.

Regards,
Clemens

---
 http-push.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/http-push.c b/http-push.c
index 5b23038..b1f5302 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1349,6 +1349,24 @@ static int unlock_remote(struct remote_lock *lock)
 	return rc;
 }
 
+static void remove_locks(void)
+{
+	struct remote_lock *lock = remote->locks;
+	
+	fprintf(stderr, "Removing remote locks...\n");
+	while (lock) {
+		unlock_remote(lock);
+		lock = lock->next;
+	}
+}
+
+static void remove_locks_on_signal(int signo)
+{
+	remove_locks();
+	signal(SIGINT, SIG_DFL);
+	raise(signo);
+}
+
 static void remote_ls(const char *path, int flags,
 		      void (*userFunc)(struct remote_ls_ctx *ls),
 		      void *userData);
@@ -2255,6 +2273,8 @@ int main(int argc, char **argv)
 		goto cleanup;
 	}
 
+	signal(SIGINT, remove_locks_on_signal);
+
 	/* Check whether the remote has server info files */
 	remote->can_update_info_refs = 0;
 	remote->has_info_refs = remote_exists("info/refs");
-- 
1.5.5.1.1.g95a6

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-05-27  7:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-22 19:55 [PATCH] http-push: remove remote locks on exit signals Clemens Buchacher
2008-05-23 21:40 ` Junio C Hamano
2008-05-23 22:17   ` Clemens Buchacher
2008-05-25 18:26     ` [PATCH] Reset the signal being handled Clemens Buchacher
2008-05-26  9:34       ` Johannes Schindelin
2008-05-26 19:35         ` [PATCH] lockfile: reset the correct signal Clemens Buchacher
2008-05-26 21:36           ` Johannes Schindelin
2008-05-27  7:49             ` Clemens Buchacher
2008-05-25 18:27     ` [PATCH] http-push: remove remote locks on exit signals Clemens Buchacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).