Merge branch 'phoenix' of https://github.com/InvictusInnovations/fc into phoenix
This commit is contained in:
commit
3de924b336
3 changed files with 25 additions and 2 deletions
|
|
@ -85,6 +85,24 @@ namespace fc {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
class path_wrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
path_wrapper(path p) :
|
||||||
|
_path(p)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
const path* operator->() const
|
||||||
|
{
|
||||||
|
return &_path;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
path _path;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class directory_iterator {
|
class directory_iterator {
|
||||||
public:
|
public:
|
||||||
directory_iterator( const fc::path& p );
|
directory_iterator( const fc::path& p );
|
||||||
|
|
@ -92,6 +110,7 @@ namespace fc {
|
||||||
~directory_iterator();
|
~directory_iterator();
|
||||||
|
|
||||||
fc::path operator*()const;
|
fc::path operator*()const;
|
||||||
|
detail::path_wrapper operator->() const;
|
||||||
directory_iterator& operator++(int);
|
directory_iterator& operator++(int);
|
||||||
directory_iterator& operator++();
|
directory_iterator& operator++();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ namespace fc {
|
||||||
directory_iterator::~directory_iterator(){}
|
directory_iterator::~directory_iterator(){}
|
||||||
|
|
||||||
fc::path directory_iterator::operator*()const { return boost::filesystem::path(*(*_p)); }
|
fc::path directory_iterator::operator*()const { return boost::filesystem::path(*(*_p)); }
|
||||||
|
detail::path_wrapper directory_iterator::operator->() const { return detail::path_wrapper(boost::filesystem::path(*(*_p))); }
|
||||||
directory_iterator& directory_iterator::operator++(int) { (*_p)++; return *this; }
|
directory_iterator& directory_iterator::operator++(int) { (*_p)++; return *this; }
|
||||||
directory_iterator& directory_iterator::operator++() { (*_p)++; return *this; }
|
directory_iterator& directory_iterator::operator++() { (*_p)++; return *this; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,10 @@ namespace fc
|
||||||
{
|
{
|
||||||
fc::ip::endpoint from;
|
fc::ip::endpoint from;
|
||||||
std::array<uint64_t, 1024> recv_buf;
|
std::array<uint64_t, 1024> recv_buf;
|
||||||
_sock.receive_from( (char*)recv_buf.data(), recv_buf.size(), from );
|
try
|
||||||
|
{
|
||||||
|
_sock.receive_from( (char*)recv_buf.data(), recv_buf.size(), from );
|
||||||
|
} FC_RETHROW_EXCEPTIONS(error, "Error reading from NTP socket");
|
||||||
|
|
||||||
uint64_t receive_timestamp_net_order = recv_buf[4];
|
uint64_t receive_timestamp_net_order = recv_buf[4];
|
||||||
uint64_t receive_timestamp_host = bswap_64(receive_timestamp_net_order);
|
uint64_t receive_timestamp_host = bswap_64(receive_timestamp_net_order);
|
||||||
|
|
@ -120,7 +123,7 @@ namespace fc
|
||||||
}
|
}
|
||||||
catch ( const fc::exception& )
|
catch ( const fc::exception& )
|
||||||
{
|
{
|
||||||
// we exepect canceled exceptions, but cannot throw
|
// we expect canceled exceptions, but cannot throw
|
||||||
// from destructor
|
// from destructor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue