Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
[simgrid.git] / src / mc / remote / Channel.hpp
index 0da0a08..c9e1aeb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -10,8 +10,7 @@
 
 #include <type_traits>
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 /** A channel for exchanging messages between model-checker and model-checked app
  *
@@ -23,6 +22,7 @@ class Channel {
   template <class M> static constexpr bool messageType() { return std::is_class_v<M> && std::is_trivial_v<M>; }
 
 public:
+  Channel() = default;
   explicit Channel(int sock) : socket_(sock) {}
   ~Channel();
 
@@ -44,15 +44,16 @@ public:
   }
 
   // Receive
-  ssize_t receive(void* message, size_t size, bool block = true) const;
+  ssize_t receive(void* message, size_t size) const;
   template <class M> typename std::enable_if_t<messageType<M>(), ssize_t> receive(M& m) const
   {
     return this->receive(&m, sizeof(M));
   }
 
+  // Socket handling
   int get_socket() const { return socket_; }
+  void reset_socket(int socket) { socket_ = socket; }
 };
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc
 
 #endif