summaryrefslogtreecommitdiff
path: root/lib/network.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/network.cc')
-rw-r--r--lib/network.cc39
1 files changed, 12 insertions, 27 deletions
diff --git a/lib/network.cc b/lib/network.cc
index cb3f94e..4957bb6 100644
--- a/lib/network.cc
+++ b/lib/network.cc
@@ -50,11 +50,11 @@ Network::~Network()
int Network::write(void *buf, int size)
{
- if(!s->isConnected()) {
+ if(!s->connected) {
// MIaV::info->error("Write attempted to a socket not connected!");
return -1;
}
- int n = send(s->ssocket, buf, size, MSG_WAITALL);
+ int n = send(s->sock, buf, size, MSG_WAITALL);
if(n == -1) {
MIaV::info->error("An error occurred!");
@@ -65,11 +65,11 @@ int Network::write(void *buf, int size)
int Network::read(void *buf, int size)
{
- if(!s->isConnected()) {
+ if(!s->connected) {
// MIaV::info->error("Read attempted from a socket not connected!");
return -1;
}
- int n = recv(s->ssocket, buf, size, MSG_WAITALL);
+ int n = recv(s->sock, buf, size, MSG_WAITALL);
if(n == -1) {
MIaV::info->error("An error occurred!");
@@ -95,7 +95,7 @@ int Network::sendPackage(n_header *h, void* buf, int bufsz)
struct msghdr msg;
struct iovec iovecs[2];
- if(!s->isConnected()) {
+ if(!s->connected) {
// MIaV::info->error("Write attempted to a socket not connected!");
return -1;
}
@@ -111,7 +111,7 @@ int Network::sendPackage(n_header *h, void* buf, int bufsz)
msg.msg_iov[1].iov_base = buf;
msg.msg_iov[1].iov_len = bufsz;
- int n = sendmsg(s->ssocket, &msg, 0);
+ int n = sendmsg(s->sock, &msg, 0);
if(n < 0) {
MIaV::info->error("A network error ocurred during sendPackage!");
return -1;
@@ -125,7 +125,7 @@ int Network::recvPackage(n_header *h, void* buf, int bufsz)
struct msghdr msg;
struct iovec iovecs[2];
- if(!s->isConnected()) {
+ if(!s->connected) {
// MIaV::info->error("Read attempted to a socket not connected!");
return -1;
}
@@ -141,7 +141,7 @@ int Network::recvPackage(n_header *h, void* buf, int bufsz)
msg.msg_iov = iovecs;
msg.msg_iovlen = 2;
- int n = recvmsg(s->ssocket, &msg, MSG_WAITALL);
+ int n = recvmsg(s->sock, &msg, MSG_WAITALL);
if(n < 0) {
MIaV::info->error("A network error ocurred during recvPackage!");
@@ -161,7 +161,7 @@ int Network::sendFrame(Frame *frame)
struct msghdr msg;
struct iovec iovecs[2];
- if(!s->isConnected()) {
+ if(!s->connected) {
// MIaV::info->error("Write attempted to a socket not connected!");
return -1;
}
@@ -196,7 +196,7 @@ int Network::sendFrame(Frame *frame)
msg.msg_iov[1].iov_base = aframe;
msg.msg_iov[1].iov_len = aframesize;
- int n = sendmsg(s->ssocket, &msg, 0);
+ int n = sendmsg(s->sock, &msg, 0);
if(n < 0) {
MIaV::info->error("A network error ocurred during sendPackage!");
@@ -215,7 +215,7 @@ Frame *Network::recvFrame()
struct msghdr msg;
struct iovec iovecs[2];
- if(!s->isConnected()) {
+ if(!s->connected) {
// MIaV::info->error("Read attempted to a socket not connected!");
return NULL;
}
@@ -239,7 +239,7 @@ Frame *Network::recvFrame()
msg.msg_iov = iovecs;
msg.msg_iovlen = 2;
- int n = recvmsg(s->ssocket, &msg, MSG_WAITALL);
+ int n = recvmsg(s->sock, &msg, MSG_WAITALL);
if(n < 0) {
MIaV::info->error("A network error ocurred during recvPackage!");
@@ -269,18 +269,3 @@ Frame *Network::recvFrame()
return frame;
}
-int Network::sendStatus(Status *status)
-{
- return 0;
-}
-
-int Network::recvStatus(Status *status)
-{
- /*
- status.diskspace = 10;
- status.diskspace_max = 100;
- status.load = 80;
- status.load_max = 100;
- */
- return 0;
-}