#include "plaqui/server/tcpserver.h"
#include <sigc++/class_slot.h>
+// FIXME - para probar mutex
+#include <glibmm/timer.h>
#ifdef DEBUG
# include <iostream>
#endif // DEBUG
-const unsigned PlaQui::Server::TCPServer::MAX_PENDING_CONNECTIONS = 5;
+const unsigned PlaQui::Server::TCPServer::MAX_PENDING_CONNECTIONS = 10;
PlaQui::Server::TCPServer::~TCPServer(void) {
#ifdef DEBUG
std::cerr << __FILE__ << ": on_connection_finished(connection = "
<< connection << ")" << std::endl;
#endif // DEBUG
- mutex.lock();
+ Glib::Mutex::Lock lock(connections_mutex);
connections.remove(connection);
#ifdef DEBUG
std::cerr << __FILE__ << ": lista de conexiones" << std::endl;
std::cerr << "\t " << *i << std::endl;
}
#endif // DEBUG
- mutex.unlock();
}
/// \todo TODO: ver tema de timeout o como salir de un accept().
std::cerr << __FILE__ << ": real_run(): connection = " << connection
<< std::endl;
#endif // DEBUG
- mutex.lock();
+ Glib::Mutex::Lock lock(connections_mutex);
+ // XXX connections_mutex.lock();
connections.push_back(connection);
#ifdef DEBUG
std::cerr << __FILE__ << ": real_run(): lista de conexiones" << std::endl;
std::cerr << "\t " << *i << std::endl;
}
#endif // DEBUG
- mutex.unlock();
+ // XXX connections_mutex.unlock(); // Si pongo el mutex antes del run(), muere.
// Conecto la señal para cuando termina una conexión, borrarla.
connection->signal_finished().connect(
SigC::bind<Connection*>(