Skip to content
Snippets Groups Projects

First unit tests

Merged Leon Dietrich requested to merge first_unit_tests into master
2 files
+ 14
2
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 7
1
@@ -126,7 +126,13 @@ tcp_client::tcp_client(
@@ -126,7 +126,13 @@ tcp_client::tcp_client(
if (connect(socket_candidate.get(), socket_identifier.ptr(), socket_identifier.size()) == 0) {
if (connect(socket_candidate.get(), socket_identifier.ptr(), socket_identifier.size()) == 0) {
status = 0;
status = 0;
this->net_socket = std::forward<auto_fd>(socket_candidate);
this->net_socket = std::forward<auto_fd>(socket_candidate);
fcntl(this->net_socket.get(), F_SETFL, fcntl(this->net_socket.get(), F_GETFL, 0) | O_NONBLOCK);
 
if (
 
const auto existing_fd_flags = fcntl(this->net_socket.get(), F_GETFL, 0);
 
existing_fd_flags == -1 || fcntl(this->net_socket.get(), F_SETFL, existing_fd_flags | O_NONBLOCK) == -1
 
) {
 
throw netio_exception("Failed to set socket mode. fcntl resulted in error:" + std::to_string(errno));
 
}
// Hier bin ich mir nicht sicher, wie ich das am besten mache. Auch mit socketaddr und type cast ist das irgendwie doof.
// Hier bin ich mir nicht sicher, wie ich das am besten mache. Auch mit socketaddr und type cast ist das irgendwie doof.
// Das Problem besteht darin, dass erst nach erfolgreichem connect der Port auf dieser Seite bekannt ist.
// Das Problem besteht darin, dass erst nach erfolgreichem connect der Port auf dieser Seite bekannt ist.
Loading