Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Commit

Permalink
[2.4.3] port fixes to windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Ninon committed Jun 20, 2017
1 parent 2f2b159 commit 2b29ec2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sources/network/windows/io_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ io_service::poll(void) {
while (!m_should_stop) {
int ndfs = init_poll_fds_info();

//! setup timeout
struct timeval* timeout_ptr = NULL;
#ifdef __TACOPIE_TIMEOUT
struct timeval timeout;
timeout.tv_usec = __TACOPIE_TIMEOUT;
timeout_ptr = &timeout;
#endif /* __TACOPIE_TIMEOUT */

__TACOPIE_LOG(debug, "polling fds");
if (select(ndfs, &m_rd_set, &m_wr_set, NULL, NULL) > 0) { process_events(); }
if (select(ndfs, &m_rd_set, &m_wr_set, NULL, timeout_ptr) > 0) { process_events(); }
else {
__TACOPIE_LOG(debug, "poll woke up, but nothing to process");
}
Expand Down Expand Up @@ -155,8 +163,6 @@ io_service::process_rd_event(const fd_t& fd, tracked_socket& socket) {
m_tracked_sockets.erase(it);
m_wait_for_removal_condvar.notify_all();
}

m_notifier.notify();
};
}

Expand Down Expand Up @@ -185,8 +191,6 @@ io_service::process_wr_event(const fd_t& fd, tracked_socket& socket) {
m_tracked_sockets.erase(it);
m_wait_for_removal_condvar.notify_all();
}

m_notifier.notify();
};
}

Expand Down Expand Up @@ -301,4 +305,4 @@ io_service::wait_for_removal(const tcp_socket& socket) {
});
}

} //! tacopie
} // namespace tacopie

0 comments on commit 2b29ec2

Please sign in to comment.