From c8df40b62cf30029a4acd1a57c8c54add54dda9b Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 20 Jul 2006 17:53:04 +0000 Subject: Utilized the global info object. Utilized the global info object. --- lib/network.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lib/network.cc') 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 #include "network.h" +#include "info.h" + #include #include #include #include -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; -- cgit v1.2.3