X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Fcomm%2FClientSocket.cpp;h=c910a1ecf377dc59ab92a9abe7a53e46a8093d1a;hp=3bff83036963d8b4301e63f0023e312895bb5273;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/source/comm/ClientSocket.cpp b/source/comm/ClientSocket.cpp index 3bff830..c910a1e 100644 --- a/source/comm/ClientSocket.cpp +++ b/source/comm/ClientSocket.cpp @@ -47,7 +47,7 @@ const Millisecond comm::ClientSocket::DefaultMaxWriteDelay(500); void comm::ClientSocket::initialize() -throw() { +{ a_status = Status::None; a_transport = NULL; a_expectedSize = -1; @@ -64,7 +64,7 @@ throw() { * porque ya está protegido por éste. */ void comm::ClientSocket::setfd(const int fd) -throw(RuntimeException) { +noexcept(false) { Socket::a_fd = fd; Socket::a_isBound = true; activate(Status::Connected); @@ -100,7 +100,7 @@ throw(RuntimeException) { * invocar al metodo comm::Receiver::initialize. */ void comm::ClientSocket::setReceiver(comm::Receiver* receiver) -throw(RuntimeException) { +noexcept(false) { if (a_receiver && Socket::a_receiverFactory) Socket::a_receiverFactory->release(a_receiver); @@ -112,7 +112,7 @@ throw(RuntimeException) { // Protegido desde el Socket::close void comm::ClientSocket::do_close() -throw() { +{ Socket::do_close(); if (a_transport != NULL) { @@ -137,7 +137,7 @@ throw() { } comm::Server* comm::ClientSocket::getServer() -throw(RuntimeException) { +noexcept(false) { Guard guard(*this, "comm::ClientSocket (getServer)"); const INetAddress& remoteAddress = getRemoteAccessPoint().getINetAddress(); const Device* device = remoteAddress.getDevice(false); @@ -174,7 +174,7 @@ throw(RuntimeException) { // la conexión. //_________________________________________________________________________________ void comm::ClientSocket::connect() -throw(RuntimeException) { +noexcept(false) { Guard guard(*this, "comm::ClientSocket (connect)"); anna_socket_assert(isConnected() == true, "Already connected"); @@ -252,13 +252,13 @@ throw(RuntimeException) { } void comm::ClientSocket::send(comm::Message& message) -throw(RuntimeException) { +noexcept(false) { Guard guard(*this, "comm::ClientSocket (send)"); do_write(getTransport()->code(message)); } void comm::ClientSocket::send(comm::Message* message) -throw(RuntimeException) { +noexcept(false) { if (message == NULL) throw RuntimeException("comm::ClientSocket::send | Cannot send a NULL message", ANNA_FILE_LOCATION); @@ -272,7 +272,7 @@ throw(RuntimeException) { // su buffer, se cerrará. //_______________________________________________________________________ void comm::ClientSocket::requestClose() -throw() { +{ Communicator* communicator = app::functions::component (ANNA_FILE_LOCATION); a_status |= Status::ClosePending; // Sólo tiene efecto real en modo ST @@ -295,7 +295,7 @@ throw() { // Se invoca desde un entorno protegido, por lo que no hace falta SSCC. //--------------------------------------------------------------------------------------- comm::Socket::Notify::_v comm::ClientSocket::receive() -throw(RuntimeException) { +noexcept(false) { Notify::_v result; if (a_reader.getMaxSize() == 0) { @@ -369,7 +369,7 @@ throw(RuntimeException) { } comm::Socket::Notify::_v comm::ClientSocket::wait(const Millisecond &timeout, const bool _receive) -throw(RuntimeException) { +noexcept(false) { Guard guard(*this, "comm::ClientSocket (wait)"); if (Socket::isOpened() == false) { @@ -410,7 +410,7 @@ throw(RuntimeException) { // la longitud esperada => prepara el a_data para recibir el siguiente bloque. //--------------------------------------------------------------------------------------- const DataBlock* comm::ClientSocket::fetch() -throw(RuntimeException) { +noexcept(false) { if (a_status & Status::ClosePending) return NULL; @@ -469,7 +469,7 @@ throw(RuntimeException) { } void comm::ClientSocket::calculeExpectedSize(const DataBlock& data) -throw() { +{ try { if ((a_expectedSize = getTransport()->calculeSize(data)) != -1) { LOGDEBUG( @@ -492,7 +492,7 @@ throw() { } comm::Transport* comm::ClientSocket::reserveTransport() -throw(RuntimeException) { +noexcept(false) { if (a_transport == NULL) { if (Socket::a_transportFactory == NULL) { string msg(asString()); @@ -513,7 +513,7 @@ throw(RuntimeException) { } comm::Transport* comm::ClientSocket::unsafe_reserveTransport() -throw(RuntimeException) { +noexcept(false) { if (a_transport == NULL) { if (Socket::a_transportFactory == NULL) { string msg(asString()); @@ -529,7 +529,7 @@ throw(RuntimeException) { } comm::Receiver* comm::ClientSocket::reserveReceiver() -throw(RuntimeException) { +noexcept(false) { if (a_receiver == NULL && Socket::a_receiverFactory != NULL) { Guard guard(this, "comm::ClientSocket::reserveReceiver"); @@ -544,7 +544,7 @@ throw(RuntimeException) { // Este metodo se sobre-escribira en commsec::ClientSocket para establecer la conexion mediante las // funciones SSH int comm::ClientSocket::do_connect(const sockaddr* s, const int len) -throw(RuntimeException) { +noexcept(false) { int r; anna_signal_shield(r, ::connect(a_fd, s, len)); return r; @@ -563,7 +563,7 @@ throw(RuntimeException) { // problemas de interpretación en el extremo remoto. //---------------------------------------------------------------------------------------------------- void comm::ClientSocket::do_write(const DataBlock& message) -throw(RuntimeException) { +noexcept(false) { int size = message.getSize(); const char* data = message.getData(); int r(0); @@ -635,7 +635,7 @@ throw(RuntimeException) { // Devuelve 0 para indicar que el Socket se ha cerrado en el extremo remoto //---------------------------------------------------------------------------- int comm::ClientSocket::do_read(const char* data, const int maxSize) -throw(RuntimeException) { +noexcept(false) { int result; do { @@ -658,7 +658,7 @@ throw(RuntimeException) { } void comm::ClientSocket::forgot() -throw() { +{ if (a_transport != NULL) a_transport->clear(); @@ -672,7 +672,7 @@ throw() { // (1) Recupera el tamano para verificar que se ha podido establecer la solicitud. //-------------------------------------------------------------------------------------- void comm::ClientSocket::getSocketOptions() -throw(RuntimeException) { +noexcept(false) { if ((a_rcvBufferSize = comm::Communicator::getReceivingChunkSize()) == -1) { socklen_t l = sizeof(int); int fd = Socket::getfd(); @@ -686,7 +686,7 @@ throw(RuntimeException) { } int comm::ClientSocket::getTotalPendingBytes() const -throw() { +{ // El nº de bytes pendientes de procesar será lo que queda en la cola I/O + los bytes que tenemos cargados en memoria // los bytes pendientes se obtiene al leer el chunk return a_pendingBytes.bytesToRead + getBufferSize(); @@ -694,7 +694,7 @@ throw() { string comm::ClientSocket::asString() const -throw() { +{ string msg("comm::ClientSocket { "); msg += Socket::asString(); @@ -713,7 +713,7 @@ throw() { } xml::Node* comm::ClientSocket::asXML(xml::Node* parent) const -throw(RuntimeException) { +noexcept(false) { xml::Node* clientSocket = parent->createChild("comm.ClientSocket"); Socket::asXML(clientSocket); @@ -737,7 +737,7 @@ throw(RuntimeException) { } string comm::ClientSocket::Status::asString(const int status) -throw() { +{ string result; if (status == 0)