summaryrefslogtreecommitdiff
path: root/tunDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tunDevice.cpp')
-rw-r--r--tunDevice.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tunDevice.cpp b/tunDevice.cpp
index 2dc7971..e4cc5af 100644
--- a/tunDevice.cpp
+++ b/tunDevice.cpp
@@ -38,6 +38,7 @@ extern "C" {
}
#include "tunDevice.h"
+#include "threadUtils.hpp"
TunDevice::TunDevice(const char* dev_name, const char* ifcfg_lp, const char* ifcfg_rnmp)
@@ -119,6 +120,7 @@ short TunDevice::read(Buffer& buf)
pfd[0].events = POLLIN | POLLPRI;
pfd[0].revents = 0;
poll(pfd, 1, -1);
+ Lock lock(io_mutex_);
return read_tun(dev_, buf, buf.getLength());
}
@@ -126,7 +128,7 @@ int TunDevice::write(Buffer& buf)
{
if(!dev_)
return -1;
-
+ Lock lock(io_mutex_);
return write_tun(dev_, buf, buf.getLength());
}