Commit a827f765 authored by Pavel Vainerman's avatar Pavel Vainerman

(unet2): добавил вылавливание исключений при создании соединения.

Подправил логи об ошибке. Немного подправил документацию.
parent b4aa6065
......@@ -30,8 +30,10 @@
\par Пример конфигурирования
По умолчанию при считывании используются свойства \a ip и \a id - в качестве порта.
Но можно переопределять эти параметры, при помощи указания \a unet_port и/или \a unet_ip.
Помимо этого можно задать broadcast-адрес по умолчанию \a unet_ip для всех узлов в
свойствах секции <nodes unet_ip="xxx.255">
\code
<nodes port="2809">
<nodes port="2809" unet_ip="192.168.56.255">
<item ip="127.0.0.1" name="LocalhostNode" textname="Локальный узел" unet_ignore="1" unet_port="3000" unet_ip="192.168.56.1">
<iocards>
...
......
......@@ -52,12 +52,18 @@ cache_init_ok(false)
catch( ost::SockException& e )
{
ostringstream s;
s << e.getString() << ": " << e.getSystemErrorString();
dlog[Debug::CRIT] << myname << "(init): " << s.str() << std::endl;
s << "(" << s_host << ":" << port << "): " << e.getString() << ": " << e.getSystemErrorString();
dlog[Debug::CRIT] << myname << "(init): (ost::SocketException) " << s.str() << std::endl;
throw SystemError(s.str());
}
catch(ost::Socket& socket)
{
ostringstream s;
s << "Could not create connection for " << s_host << ":" << port;
dlog[Debug::CRIT] << myname << "(init): (ost::Socket) " << s.str() << std::endl;
throw SystemError(s.str());
}
r_thr = new ThreadCreator<UNetReceiver>(this, &UNetReceiver::receive);
u_thr = new ThreadCreator<UNetReceiver>(this, &UNetReceiver::update);
......
......@@ -45,10 +45,18 @@ s_thr(0)
catch( ost::SockException& e )
{
ostringstream s;
s << e.getString() << ": " << e.getSystemErrorString() << endl;
s << "(" << s_host << ":" << port << "): " << e.getString() << ": " << e.getSystemErrorString();
dlog[Debug::CRIT] << myname << "(init): (ost::SocketException) " << s.str() << std::endl;
throw SystemError(s.str());
}
catch(ost::Socket& socket)
{
ostringstream s;
s << "Could not create connection for " << s_host << ":" << port;
dlog[Debug::CRIT] << myname << "(init): (ost::Socket) " << s.str() << std::endl;
throw SystemError(s.str());
}
s_thr = new ThreadCreator<UNetSender>(this, &UNetSender::send);
// -------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment