Commit 8a5d71b1 authored by Yoann Pigné's avatar Yoann Pigné

client waits for server forever, but no recursion

parent a0009e2f
...@@ -40,30 +40,25 @@ _stream_name(stream),_host(host),_port(port),_stream(),_socket(host,port),debug( ...@@ -40,30 +40,25 @@ _stream_name(stream),_host(host),_port(port),_stream(),_socket(host,port),debug(
void NetStreamSender::init() void NetStreamSender::init()
{ {
_stream.writeString(_stream_name); _stream.writeString(_stream_name);
try{
_socket.connect(); int wait_for_server = 1;
} catch(NetStreamSocketException e){ while(wait_for_server){
std::cout<<"No available connection on "<<_host<<":"<<_port<<". Waiting."; try{
sleep(1); _socket.connect();
_connect(); if(wait_for_server > 1)
std::cout<<std::endl<<"Connection established."<<std::endl; std::cout<<std::endl<<"Connection established."<<std::endl;
} wait_for_server = 0;
} catch(NetStreamSocketException e){
} if(wait_for_server == 1)
void NetStreamSender::_connect(){ std::cout<<"No available connection on "<<_host<<":"<<_port<<". Waiting.";
try{ else
_socket.connect(); std::cout<<"."<<std::flush;
} catch(NetStreamSocketException e){ wait_for_server++;
std::cout<<"."<<std::flush ; sleep(1);
sleep(1); }
_connect();
} }
} }
// =========================================== // ===========================================
// = Values type guess (templates) = // = Values type guess (templates) =
// =========================================== // ===========================================
......
...@@ -38,8 +38,7 @@ protected: ...@@ -38,8 +38,7 @@ protected:
bool debug; bool debug;
void init(); void init();
void _connect();
template <typename T> template <typename T>
int getType(T t) int getType(T t)
{ {
......
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