Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Boost REQUIRED COMPONENTS date_time exception filesystem log system)
find_package(Boost REQUIRED COMPONENTS date_time exception filesystem log)
find_package(ICU REQUIRED COMPONENTS uc)
find_package(JsonCpp REQUIRED)
if(WITH_DCMTK)
Expand Down
4 changes: 2 additions & 2 deletions src/odil/Association.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ ::Association()
_transfer_syntaxes_by_abstract_syntax(), _transfer_syntaxes_by_id(),
_next_message_id(1)
{
this->set_tcp_timeout(boost::posix_time::pos_infin);
this->set_message_timeout(boost::posix_time::seconds(30));
this->set_tcp_timeout(std::chrono::nanoseconds::max());
this->set_message_timeout(std::chrono::seconds(30));
}

Association
Expand Down
2 changes: 1 addition & 1 deletion src/odil/MoveSCU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ::_move(
while(!done)
{
// Use a small timeout to avoid blocking for a long time.
boost::posix_time::milliseconds const timeout(10);
std::chrono::milliseconds timeout(10);
store_association.set_tcp_timeout(timeout);
store_association.set_message_timeout(timeout);

Expand Down
4 changes: 2 additions & 2 deletions src/odil/dul/StateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ ::start_timer(EventData & data)
return;


auto const canceled = this->_artim_timer.expires_from_now(this->_timeout);
auto const canceled = this->_artim_timer.expires_after(this->_timeout);
if(canceled != 0)
{
throw Exception("ARTIM timer started with pending operations");
Expand Down Expand Up @@ -300,7 +300,7 @@ ::stop_timer()
return;


this->_artim_timer.expires_at(boost::posix_time::pos_infin);
this->_artim_timer.expires_at(boost::asio::steady_timer::time_point::max());
this->_transport.get_service().poll();
// FIXME: check that the timer was aborted
/*
Expand Down
4 changes: 2 additions & 2 deletions src/odil/dul/StateMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ODIL_API StateMachine
};

/// @brief Duration of the timeout.
typedef boost::asio::deadline_timer::duration_type duration_type;
typedef std::chrono::nanoseconds duration_type;

/// @brief Constructor, initializing to Sta1.
StateMachine();
Expand Down Expand Up @@ -156,7 +156,7 @@ class ODIL_API StateMachine
duration_type _timeout;

/// @brief Association Request/Reject/Release Timer.
boost::asio::deadline_timer _artim_timer;
boost::asio::steady_timer _artim_timer;

/// @brief Callback checking whether an association request is acceptable.
AssociationAcceptor _association_acceptor;
Expand Down
4 changes: 2 additions & 2 deletions src/odil/dul/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void
Transport
::_start_deadline(Source & source, boost::system::error_code & error)
{
auto const canceled = this->_deadline.expires_from_now(this->_timeout);
auto const canceled = this->_deadline.expires_after(this->_timeout);
if(canceled != 0)
{
throw Exception("TCP timer started with pending operations");
Expand All @@ -254,7 +254,7 @@ void
Transport
::_stop_deadline()
{
this->_deadline.expires_at(boost::posix_time::pos_infin);
this->_deadline.expires_at(boost::asio::steady_timer::time_point::max());
}

void
Expand Down
4 changes: 2 additions & 2 deletions src/odil/dul/Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct ODIL_API Transport
typedef boost::asio::ip::tcp::socket Socket;

/// @brief Duration of the timeout.
typedef boost::asio::deadline_timer::duration_type duration_type;
typedef std::chrono::steady_clock::duration duration_type;

/// @brief Constructor.
Transport();
Expand Down Expand Up @@ -98,7 +98,7 @@ struct ODIL_API Transport
boost::asio::io_service _service;
std::shared_ptr<Socket> _socket;
duration_type _timeout;
boost::asio::deadline_timer _deadline;
boost::asio::steady_timer _deadline;

std::shared_ptr<boost::asio::ip::tcp::acceptor> _acceptor;

Expand Down
2 changes: 1 addition & 1 deletion tests/code/EchoSCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct Status
void run_server(Status * status)
{
odil::Association association;
association.set_tcp_timeout(boost::posix_time::seconds(1));
association.set_tcp_timeout(std::chrono::seconds(1));

try
{
Expand Down
2 changes: 1 addition & 1 deletion tests/code/FindSCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Generator: public odil::SCP::DataSetGenerator
void run_server(Status * status)
{
odil::Association association;
association.set_tcp_timeout(boost::posix_time::seconds(1));
association.set_tcp_timeout(std::chrono::seconds(1));

try
{
Expand Down
2 changes: 1 addition & 1 deletion tests/code/GetSCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Generator: public odil::GetSCP::DataSetGenerator
void run_server(Status * status)
{
odil::Association association;
association.set_tcp_timeout(boost::posix_time::seconds(1));
association.set_tcp_timeout(std::chrono::seconds(1));

try
{
Expand Down
2 changes: 1 addition & 1 deletion tests/code/MoveSCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Generator: public odil::MoveSCP::DataSetGenerator
void run_server(Status * status)
{
odil::Association association;
association.set_tcp_timeout(boost::posix_time::seconds(1));
association.set_tcp_timeout(std::chrono::seconds(1));

try
{
Expand Down
2 changes: 1 addition & 1 deletion tests/code/NCreateSCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct Status
void run_server(Status * status)
{
odil::Association association;
association.set_tcp_timeout(boost::posix_time::seconds(1));
association.set_tcp_timeout(std::chrono::seconds(1));

try
{
Expand Down
2 changes: 1 addition & 1 deletion tests/code/SCPDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct Status
void run_server(Status * status, bool with_echo)
{
odil::Association association;
association.set_tcp_timeout(boost::posix_time::seconds(1));
association.set_tcp_timeout(std::chrono::seconds(1));

try
{
Expand Down
6 changes: 3 additions & 3 deletions wrappers/python/Association.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ void receive_association(

float get_tcp_timeout(odil::Association const& association)
{
return association.get_tcp_timeout().total_microseconds()/1000000.f;
return std::chrono::duration_cast<std::chrono::microseconds>(association.get_tcp_timeout()).count() / 1000000.f;

}

void set_tcp_timeout(odil::Association& association, float seconds)
{
association.set_tcp_timeout(
boost::posix_time::microseconds(int(seconds*1000000.f)));
association.set_tcp_timeout(std::chrono::microseconds(int(seconds*1000000.f)));
}

}
Expand Down