in_buf(new char[buf_size]),
in_begin(in_buf),
in_end(in_buf),
- out_buf(new char[buf_size])
+ out_buf(new char[buf_size]),
+ good(true)
{
socket.signal_data_available.connect(sigc::mem_fun(this, &Communicator::data_available));
}
void Communicator::initiate_handshake()
{
if(handshake_status!=0)
- throw InvalidState("Handshaking is already underway or done");
+ throw sequence_error("handshaking already done");
send_handshake();
handshake_status = 1;
void Communicator::data_available()
{
+ if(!good)
+ return;
+
in_end += socket.read(in_end, in_buf+buf_size-in_end);
try
{
signal_handshake_done.emit();
}
else
- socket.close();
+ good = false;
}
}
}
}
catch(...)
{
- socket.close();
+ good = false;
throw;
}
}