X-Git-Url: https://git.llucax.com/z.facultad/75.74/practicos.git/blobdiff_plain/3de68addc94548e2191d83b7aa4ebec21957391e..e4fc91d44fb531c591f0b1ac5c2a8ee472bf7dc9:/practicas/pipi/src/media.cpp?ds=inline 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 :