From 0aa919f7f583e2b518dfbe096721db7fb199508f Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Fri, 20 Feb 2009 14:56:34 +0000 Subject: added some log messages --- src/anytun.cpp | 10 +++++++--- src/packetSource.cpp | 3 +++ 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); } -- cgit v1.2.3