trace: reimplement the DTRACE function so it doesn't use a vector
[gem5.git] / src / base / socket.cc
index 45a60e7e37b1c654795f4706fdcb1ff3700885ab..0c8903084ab4f2e310834144f8d06d25de19e15f 100644 (file)
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
  */
 
-#include <sys/types.h>
-#include <sys/socket.h>
-
 #include <netinet/in.h>
 #include <netinet/tcp.h>
-
-#include <errno.h>
+#include <sys/socket.h>
+#include <sys/types.h>
 #include <unistd.h>
 
-#include "sim/host.hh"
+#include <cerrno>
+
 #include "base/misc.hh"
 #include "base/socket.hh"
+#include "base/types.hh"
 
 using namespace std;
 
+bool ListenSocket::listeningDisabled = false;
+bool ListenSocket::anyListening = false;
+
+void
+ListenSocket::disableAll()
+{
+    if (anyListening)
+        panic("Too late to disable all listeners, already have a listener");
+    listeningDisabled = true;
+}
+
+bool
+ListenSocket::allDisabled()
+{
+    return listeningDisabled;
+}
+
 ////////////////////////////////////////////////////////////////////////
 //
 //
@@ -90,6 +108,7 @@ ListenSocket::listen(int port, bool reuse)
 
     listening = true;
 
+    anyListening = true;
     return true;
 }