Skip to content

Instantly share code, notes, and snippets.

@lfittl
Created December 20, 2010 18:35
Show Gist options
  • Save lfittl/748780 to your computer and use it in GitHub Desktop.
Save lfittl/748780 to your computer and use it in GitHub Desktop.
diff --git a/mongrel2.c b/mongrel2.c
index 5abc4e5..61aab9d 100644
--- a/mongrel2.c
+++ b/mongrel2.c
@@ -227,6 +227,7 @@ Server *reload_server(Server *old_srv, const char *db_file, const char *server_u
Config_stop_proxies();
Config_stop_dirs();
Setting_destroy();
+ Register_disconnect_all();
Server *srv = load_server(db_file, server_uuid, old_srv->listen_fd);
check(srv, "Failed to load new server config.");
diff --git a/register.c b/register.c
index cac523c..755285f 100644
--- a/register.c
+++ b/register.c
@@ -105,6 +105,16 @@ error:
return -1;
}
+void Register_disconnect_all()
+{
+ int i = 0;
+ for(i = 0; i < MAX_REGISTERED_FDS; i++) {
+ if (REGISTRATIONS[i].conn_type) {
+ Register_disconnect(i);
+ }
+ }
+}
+
int Register_ping(int fd)
{
assert(fd < MAX_REGISTERED_FDS && "FD given to register is greater than max.");
diff --git a/register.h b/register.h
index 074ec4c..211c8f2 100644
--- a/register.h
+++ b/register.h
@@ -57,6 +57,8 @@ int Register_connect(int fd, int conn_type);
int Register_disconnect(int fd);
+void Register_disconnect_all();
+
int Register_ping(int fd);
void Register_init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment