From e4fc91d44fb531c591f0b1ac5c2a8ee472bf7dc9 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sun, 28 May 2006 19:19:28 +0000 Subject: [PATCH] Mejora debug. --- practicas/pipi/src/media.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/practicas/pipi/src/media.cpp b/practicas/pipi/src/media.cpp index 5a3077e..823703c 100644 --- a/practicas/pipi/src/media.cpp +++ b/practicas/pipi/src/media.cpp @@ -1,5 +1,7 @@ #include "media.h" +#ifdef DEBUG #include +#endif Media::Media(key_t key) throw (std::runtime_error) { @@ -10,16 +12,24 @@ Media::Media(key_t key) throw (std::runtime_error) void Media::transmit(const Frame& frame) { - std::cout << "tx -> msgtype = " << *(((int*)&frame)+1) << "\n"; +#ifdef DEBUG + std::cout << "Media::transmit(msgtype/mac = " << *(((int*)&frame)+1) + << ", size = " << frame.size() << ", data = " << frame.data() << ")\n"; +#endif + // HACK ASQUEROSO para pasarle por encima a la vtable... :-O~ if (msgsnd(que_id, ((int*)&frame)+1, frame.size(), 0) == -1) throw std::runtime_error("Error al poner en la cola"); } void Media::receive(Frame& frame) { - std::cout << "rx -> msgtype = " << *(((int*)&frame)+1) << "\n"; + // HACK ASQUEROSO para pasarle por encima a la vtable... :-O~ if (msgrcv(que_id, ((int*)&frame)+1, frame.size(), frame.mac(), 0) == -1) throw std::runtime_error("Error al sacar de la cola"); +#ifdef DEBUG + std::cout << "Media::receive(msgtype/mac = " << *(((int*)&frame)+1) + << ", size = " << frame.size() << ", data = " << frame.data() << ")\n"; +#endif } // vim: set et sw=4 sts=4 : -- 2.43.0