summaryrefslogtreecommitdiff
path: root/tunDevice.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2007-06-18 01:37:58 +0000
committerChristian Pointner <equinox@anytun.org>2007-06-18 01:37:58 +0000
commitfc704485589e2b1841d587e26f74794ac59c00d4 (patch)
tree0d28b10d3a1d0c0d53e6106521a11c29c143a966 /tunDevice.cpp
parentremoved silly reference @ buffer [] operator (diff)
readded not silly refernce
removed really silly refernce some tests with poll()
Diffstat (limited to 'tunDevice.cpp')
-rw-r--r--tunDevice.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tunDevice.cpp b/tunDevice.cpp
index bfac2a4..0f17fb7 100644
--- a/tunDevice.cpp
+++ b/tunDevice.cpp
@@ -29,6 +29,7 @@
*/
#include <stdexcept>
+#include <poll.h>
extern "C" {
#include "openvpn/config.h"
@@ -105,14 +106,17 @@ TunDevice::~TunDevice()
close_tun(dev_);
}
-int TunDevice::read(Buffer& buf)
+short TunDevice::read(Buffer& buf)
{
if(!dev_)
return -1;
- perf_push (PERF_READ_IN_TUN);
-
- return read_tun(dev_, buf, buf.getLength());
+ struct pollfd pfd[1];
+ pfd[0].fd = tun_event_handle(dev_);
+// pfd[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | POLLOUT | POLLWRNORM | POLLWRBAND | POLLERR | POLLHUP | POLLNVAL;
+ pfd[0].events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI;
+ poll(pfd, 1, -1);
+ return pfd[0].revents;//read_tun(dev_, buf, buf.getLength());
}
int TunDevice::write(Buffer& buf)