Make sure code compiles on Ubuntu 12.04 with boost 1.46
Work with permissions in boost::filesystem was introduced in boost 1.49
diff --git a/ccnx/ccnx-discovery.cpp b/ccnx/ccnx-discovery.cpp
index afb0307..e6c4e84 100644
--- a/ccnx/ccnx-discovery.cpp
+++ b/ccnx/ccnx-discovery.cpp
@@ -22,12 +22,12 @@
TaggedFunction::GetRandomTag()
{
//boost::random::random_device rng;
- boost::random::uniform_int_distribution<> dist(0, CHAR_SET.size() - 1);
+ //boost::random::uniform_int_distribution<> dist(0, CHAR_SET.size() - 1);
ostringstream oss;
- for (int i = 0; i < DEFAULT_TAG_SIZE; i++)
- {
+ //for (int i = 0; i < DEFAULT_TAG_SIZE; i++)
+ //{
//oss << CHAR_SET[dist(rng)];
- }
+ //}
return oss.str();
}
diff --git a/ccnx/ccnx-discovery.h b/ccnx/ccnx-discovery.h
index 959167a..b03a937 100644
--- a/ccnx/ccnx-discovery.h
+++ b/ccnx/ccnx-discovery.h
@@ -28,8 +28,7 @@
#include "scheduler.h"
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-#include <boost/random/random_device.hpp>
-#include <boost/random/uniform_int_distribution.hpp>
+#include <boost/random.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/locks.hpp>
#include <list>
diff --git a/server/server.cpp b/server/server.cpp
index df790ed..11b74cb 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -20,7 +20,7 @@
server::server(const std::string& address, const std::string& port,
const std::string& doc_root)
: io_service_(),
- signals_(io_service_),
+ // signals_(io_service_),
acceptor_(io_service_),
connection_manager_(),
new_connection_(),
@@ -29,12 +29,12 @@
// 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));
+// 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_);
diff --git a/server/server.hpp b/server/server.hpp
index b82088b..8a81b06 100644
--- a/server/server.hpp
+++ b/server/server.hpp
@@ -51,7 +51,7 @@
boost::asio::io_service io_service_;
/// The signal_set is used to register for process termination notifications.
- boost::asio::signal_set signals_;
+ // boost::asio::signal_set signals_;
/// Acceptor used to listen for incoming connections.
boost::asio::ip::tcp::acceptor acceptor_;
diff --git a/src/dispatcher.cc b/src/dispatcher.cc
index 717fadb..390cb4a 100644
--- a/src/dispatcher.cc
+++ b/src/dispatcher.cc
@@ -235,7 +235,13 @@
{
m_actionLog->AddLocalActionUpdate (relativeFilePath.generic_string(),
*hash,
- last_write_time (absolutePath), status (absolutePath).permissions (), seg_num);
+ last_write_time (absolutePath),
+#if BOOST_VERSION >= 104900
+ status (absolutePath).permissions (),
+#else
+ 0,
+#endif
+ seg_num);
// notify SyncCore to propagate the change
m_core->localStateChangedDelayed ();
@@ -473,7 +479,9 @@
{
if (filesystem::exists (filePath) &&
filesystem::last_write_time (filePath) == file->mtime () &&
+#if BOOST_VERSION >= 104900
filesystem::status (filePath).permissions () == static_cast<filesystem::perms> (file->mode ()) &&
+#endif
*Hash::FromFileContent (filePath) == hash)
{
_LOG_DEBUG ("Asking to assemble a file, but file already exists on a filesystem");
@@ -491,7 +499,9 @@
if (ok)
{
last_write_time (filePath, file->mtime ());
+#if BOOST_VERSION >= 104900
permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
+#endif
m_fileState->SetFileComplete (file->filename ());
}
diff --git a/src/fetcher.h b/src/fetcher.h
index 185e2a1..515b2e9 100644
--- a/src/fetcher.h
+++ b/src/fetcher.h
@@ -28,6 +28,7 @@
#include "executor.h"
#include <boost/intrusive/list.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <set>
#include <set>
diff --git a/src/state-server.cc b/src/state-server.cc
index f0616b0..2d1d96a 100644
--- a/src/state-server.cc
+++ b/src/state-server.cc
@@ -463,7 +463,9 @@
{
if (filesystem::exists (filePath) &&
filesystem::last_write_time (filePath) == file->mtime () &&
+#if BOOST_VERSION >= 104900
filesystem::status (filePath).permissions () == static_cast<filesystem::perms> (file->mode ()) &&
+#endif
*Hash::FromFileContent (filePath) == hash)
{
m_ccnx->publishData (interest, "OK: File already exists", 1);
@@ -481,7 +483,9 @@
if (m_objectManager.objectsToLocalFile (deviceName, hash, filePath))
{
last_write_time (filePath, file->mtime ());
+#if BOOST_VERSION >= 104900
permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
+#endif
m_ccnx->publishData (interest, "OK", 1);
}
else