auto-update works

Change-Id: I49c0c5982d641d51d4f79ee201ae60a127af6c03
diff --git a/.gitignore b/.gitignore
index 2ee3862..53e0e87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@
 *.app
 *.DS_Store
 osx/Frameworks/Sparkle.framework
+Sparkle*
+*priv.pem
diff --git a/gui/chronosharegui.cpp b/gui/chronosharegui.cpp
index cdc5dc0..1dbb402 100644
--- a/gui/chronosharegui.cpp
+++ b/gui/chronosharegui.cpp
@@ -52,7 +52,7 @@
   , m_executor (1)
 #endif
 #ifdef SPARKLE_SUPPORTED
-  , m_autoUpdate(new SparkleAutoUpdate(tr("http://irl.cs.ucla.edu")))
+  , m_autoUpdate(new SparkleAutoUpdate(tr("http://irl.cs.ucla.edu/~zhenkai/chronoshare_dist/chronoshare.xml")))
 #endif
 {
   setWindowTitle("Settings");
@@ -164,7 +164,6 @@
 
   delete m_watcher; // stop filewatching ASAP
   delete m_dispatcher; // stop dispatcher ASAP, but after watcher (to prevent triggering callbacks on deleted object)
-  m_httpServer->handle_stop();
   delete m_httpServer;
 
   // cleanup
diff --git a/osx/dsa_pub.pem b/osx/dsa_pub.pem
new file mode 100644
index 0000000..492a325
--- /dev/null
+++ b/osx/dsa_pub.pem
@@ -0,0 +1,12 @@
+-----BEGIN PUBLIC KEY-----
+MIIBuDCCASwGByqGSM44BAEwggEfAoGBAKhLs5ggPDzXB1IwphPc7oHgUQYMG5MY
+WGC38Qm5iH6wpgCVEk1ItZKO9BVTjr61ABLvuuGpc34F3lCdunmKdWr6HD6o58Gv
+aa5YXqO8I4Nbg3/xIG5hugx6HdjxNxLeJJQcgLWoqv5c0TXf3gJwCzoq5jdON7Pq
+eBF5JFdMlyR1AhUAgbTZqZej1+16QXEdWV8wcerft90CgYEAgWprCCsEgUsGi1Ab
+3J7cdDlzEu+KUWngClmUMMvBhpOdhVGNgzWTB5s1isDVye7KNDBpIxa/4m2TYlp1
+d1H2ssZiJcEQh5vdDaSR07Fb5s0fsi/9oMW0xWjovs8i1QNGv2K28cZyEuRgJngy
+Vvbk0qfSwS29Z52WWCX7uBCFQqQDgYUAAoGBAJoIIO5e+mgSBE7jcc+6YImOZLdt
+CwWosAnZw7z23mzD1PfegYgNDt9bVefoZDCy2Ci/yhddTAhWgDnORpJ4rQCELVYx
+02ZiMxkQiLDSakEbs1kSCap9svLUNYLt/rVC/3QQa7Qc/96WqhycpGgYOquwEbz1
+Gu8LU+Ikd9mOVJXq
+-----END PUBLIC KEY-----
diff --git a/osx/osxdist.py b/osx/osxdist.py
index 77c7546..28e01b1 100644
--- a/osx/osxdist.py
+++ b/osx/osxdist.py
@@ -376,7 +376,7 @@
   a = AppBundle('ChronoShare.app', ver)
   a.copy_qt_plugins()
   a.handle_libs()
-  a.copy_resources(['../gui/images', '../gui/html', '../osx/qt.conf'])
+  a.copy_resources(['../gui/images', '../gui/html', '../osx/qt.conf', '../osx/dsa_pub.pem'])
   a.update_plist()
   a.set_min_macosx_version('10.8.0')
   a.done()
diff --git a/server/server.cpp b/server/server.cpp
index fa20be7..5d73549 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -29,12 +29,14 @@
   // Register to handle the signals that indicate when the server should exit.
   // It is safe to register for the same signal multiple times in a program,
   // provided all registration for the specified signal is made through Asio.
+  /*
   signals_.add(SIGINT);
   signals_.add(SIGTERM);
 #if defined(SIGQUIT)
   signals_.add(SIGQUIT);
 #endif // defined(SIGQUIT)
   signals_.async_wait(boost::bind(&server::handle_stop, this));
+  */
 
   // Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
   boost::asio::ip::tcp::resolver resolver(io_service_);
@@ -50,6 +52,11 @@
   _LOG_DEBUG("Listen on [" << address << ": " << port << "] with doc_root = " << doc_root);
 }
 
+server::~server()
+{
+  handle_stop();
+}
+
 void server::run()
 {
   // The io_service::run() call will block until all asynchronous operations
diff --git a/server/server.hpp b/server/server.hpp
index 408f7b9..d6e50a9 100644
--- a/server/server.hpp
+++ b/server/server.hpp
@@ -34,10 +34,12 @@
   /// Run the server's io_service loop.
   void run();
 
+  ~server();
+
+private:
   /// Handle a request to stop the server.
   void handle_stop();
 
-private:
   /// Initiate an asynchronous accept operation.
   void start_accept();
 
diff --git a/wscript b/wscript
index 2c30e6c..8fd2b02 100644
--- a/wscript
+++ b/wscript
@@ -229,6 +229,8 @@
     <string>%s</string>
     <key>LSUIElement</key>
     <string>1</string>
+    <key>SUPublicDSAKeyFile</key>
+    <string>dsa_pub.pem</string>
 </dict>
 </plist>'''
         qt.mac_app = "ChronoShare.app"