diff options
Diffstat (limited to 'lib/network.cc')
-rw-r--r-- | lib/network.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/network.cc b/lib/network.cc index 799bc98..f00d358 100644 --- a/lib/network.cc +++ b/lib/network.cc @@ -27,14 +27,15 @@ #include <config.h> #include "network.h" +#include "info.h" + #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> -Network::Network(Socket *gs, Info *ginfo) +Network::Network(Socket *gs) { - info = ginfo; s = gs; } @@ -45,13 +46,13 @@ Network::~Network() int Network::write(void *buf, int size) { if(!s->isConnected()) { - // info->error("Write attempted to a socket not connected!"); + // MIaV::info->error("Write attempted to a socket not connected!"); return -1; } int n = send(s->ssocket, buf, size, MSG_WAITALL); if(n == -1) { - info->error("An error occurred!"); + MIaV::info->error("An error occurred!"); } return n; @@ -60,13 +61,13 @@ int Network::write(void *buf, int size) int Network::read(void *buf, int size) { if(!s->isConnected()) { - // info->error("Read attempted from a socket not connected!"); + // MIaV::info->error("Read attempted from a socket not connected!"); return -1; } int n = recv(s->ssocket, buf, size, MSG_WAITALL); if(n == -1) { - info->error("An error occurred!"); + MIaV::info->error("An error occurred!"); } return n; @@ -90,7 +91,7 @@ int Network::sendPackage(n_header *h, void* buf, int bufsz) struct iovec iovecs[2]; if(!s->isConnected()) { - // info->error("Write attempted to a socket not connected!"); + // MIaV::info->error("Write attempted to a socket not connected!"); return -1; } @@ -107,7 +108,7 @@ int Network::sendPackage(n_header *h, void* buf, int bufsz) int n = sendmsg(s->ssocket, &msg, 0); if(n < 0) { - info->error("A network error ocurred during sendPackage!"); + MIaV::info->error("A network error ocurred during sendPackage!"); return -1; } @@ -120,7 +121,7 @@ int Network::recvPackage(n_header *h, void* buf, int bufsz) struct iovec iovecs[2]; if(!s->isConnected()) { - // info->error("Read attempted to a socket not connected!"); + // MIaV::info->error("Read attempted to a socket not connected!"); return -1; } @@ -138,12 +139,12 @@ int Network::recvPackage(n_header *h, void* buf, int bufsz) int n = recvmsg(s->ssocket, &msg, MSG_WAITALL); if(n < 0) { - info->error("A network error ocurred during recvPackage!"); + MIaV::info->error("A network error ocurred during recvPackage!"); return -1; } if(msg.msg_iovlen != 2) { - info->error("Wrong package format!"); + MIaV::info->error("Wrong package format!"); return -1; } return n; |