summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2009-02-20 14:56:34 +0000
committerOthmar Gsenger <otti@anytun.org>2009-02-20 14:56:34 +0000
commit0aa919f7f583e2b518dfbe096721db7fb199508f (patch)
treedb606485f2ff95e654abeef2b128546aea0ff0ea
parentwindows service works now (diff)
added some log messages
-rw-r--r--src/anytun.cpp10
-rw-r--r--src/packetSource.cpp3
2 files changed, 10 insertions, 3 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp
index fc7404c..dbcedb6 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -212,7 +212,9 @@ void sender(void* p)
try {
param->src.send(encrypted_packet.getBuf(), encrypted_packet.getLength(), conn.remote_end_);
- } catch (std::exception& e) { } // ignoring icmp port unreachable :) and other socket errors :(
+ } catch (std::exception& e) {
+ cLog.msg(Log::PRIO_ERR) << "could not send data: " << e.what();
+ }
}
}
catch(std::runtime_error& e) {
@@ -246,8 +248,10 @@ void receiver(void* p)
int len;
try {
len = param->src.recv(encrypted_packet.getBuf(), encrypted_packet.getLength(), remote_end);
- } catch (std::exception& e) { continue; }
- // ignoring icmp port unreachable :) and other socket errors :(
+ } catch (std::exception& e) {
+ cLog.msg(Log::PRIO_ERR) << "could not recive packet "<< e.what();
+ continue;
+ }
if(len < 0)
continue; // silently ignore socket recv errors, this is probably no good idea...
diff --git a/src/packetSource.cpp b/src/packetSource.cpp
index b6eebbe..2541894 100644
--- a/src/packetSource.cpp
+++ b/src/packetSource.cpp
@@ -33,12 +33,14 @@
#include "datatypes.h"
#include "packetSource.h"
+#include "log.h"
UDPPacketSource::UDPPacketSource(std::string port) : sock_(io_service_)
{
proto::resolver resolver(io_service_);
proto::resolver::query query(port);
proto::endpoint e = *resolver.resolve(query);
+ cLog.msg(Log::PRIO_NOTICE) << "openeing socket: " << e;
sock_.open(e.protocol());
sock_.bind(e);
}
@@ -48,6 +50,7 @@ UDPPacketSource::UDPPacketSource(std::string localaddr, std::string port) : sock
proto::resolver resolver(io_service_);
proto::resolver::query query(localaddr, port);
proto::endpoint e = *resolver.resolve(query);
+ cLog.msg(Log::PRIO_NOTICE) << "openeing socket: " << e;
sock_.open(e.protocol());
sock_.bind(e);
}