X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fcommand_server.cpp;h=f5968603e77ecc60c4f81f85e784ee7a42e97885;hp=cc66de4f58eadd3610eda2dc71d78a1dca9a1333;hb=c7857475c8b0f02cac3ce29a617a4d542fa59f37;hpb=539b09c0c1819f9394e5a0ae8b3df3687715fa7c diff --git a/src/command_server.cpp b/src/command_server.cpp index cc66de4..f596860 100644 --- a/src/command_server.cpp +++ b/src/command_server.cpp @@ -166,7 +166,21 @@ void command_server::handle(long long usec_timeout, long long* usec_timeout_rema unsigned int conn_id; while (s.get_packet(packet,conn_id)) - handle_packet(packet,s.get_connection(conn_id)); + { + server_connection* conn=s.get_connection(conn_id); + if (!conn) + EXCEPTIONSTREAM(error,logic_error,"illegal connection id " << conn_id << " received"); + + try + { handle_packet(packet,conn); } + catch (t2n_transfer_error &e) + { + // shut down a connection with transfer errors (usually write errors) + conn->close(); + } + catch(...) + { throw; } + } } s.cleanup(); }