summaryrefslogtreecommitdiff
path: root/src/server/server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/server.cc')
-rw-r--r--src/server/server.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/server/server.cc b/src/server/server.cc
index a025a7d..e89de0d 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -8,13 +8,13 @@
#include <utility>
#include <arpa/inet.h>
#include <sys/socket.h>
+#include <stdexcept>
#include <unistd.h>
#include "../voltronic/exceptions.h"
#include "../p18/exceptions.h"
#include "../voltronic/time.h"
#include "../logging.h"
-//#include "hexdump/hexdump.h"
#include "server.h"
#include "connection.h"
#include "signal.h"
@@ -31,9 +31,20 @@ Server::Server(std::shared_ptr<voltronic::Device> device)
, deviceErrorCounter_(0)
, verbose_(false)
, device_(std::move(device)) {
+
client_.setDevice(device_);
}
+Server::~Server() {
+ if (sock_ > 0)
+ close(sock_);
+}
+
+
+/**
+ * Common stuff, getters, setters
+ */
+
void Server::setVerbose(bool verbose) {
verbose_ = verbose;
device_->setVerbose(verbose);
@@ -51,10 +62,10 @@ void Server::setDeviceErrorLimit(u32 deviceErrorLimit) {
deviceErrorLimit_ = deviceErrorLimit;
}
-Server::~Server() {
- if (sock_ > 0)
- close(sock_);
-}
+
+/**
+ * TCP Server
+ */
void Server::start(std::string& host, int port) {
host_ = host;