]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/src/tcpserver.cpp
-ahi borre lo que se me escapo
[z.facultad/75.42/plaqui.git] / Server / src / tcpserver.cpp
index 9d83135a2f48e1e3aca16604d489bf039e0192c8..0f97fe5a762b5fbaebcfc0410ff62685cbad39cf 100644 (file)
@@ -37,8 +37,6 @@ namespace PlaQui {
 
 namespace Server {
 
 
 namespace Server {
 
-const unsigned TCPServer::MAX_PENDING_CONNECTIONS = 10;
-
 TCPServer::~TCPServer(void) {
 #ifdef DEBUG
        cerr << __FILE__ <<  ": destructor." << endl;
 TCPServer::~TCPServer(void) {
 #ifdef DEBUG
        cerr << __FILE__ <<  ": destructor." << endl;
@@ -61,8 +59,7 @@ TCPServer::TCPServer(int port):       socket(sockbuf::sock_stream) {
 #endif // DEBUG
 }
 
 #endif // DEBUG
 }
 
-void TCPServer::on_connection_finished(
-               Connection* connection) {
+void TCPServer::on_connection_finished(Connection* connection) {
 #ifdef DEBUG
        cerr << __FILE__ <<  ": on_connection_finished(connection = "
                << connection << ")" << endl;
 #ifdef DEBUG
        cerr << __FILE__ <<  ": on_connection_finished(connection = "
                << connection << ")" << endl;
@@ -113,6 +110,21 @@ void TCPServer::real_run(void) {
        }
 }
 
        }
 }
 
+TCPServer::ConnectionInfoList TCPServer::get_connected(void) {
+#ifdef DEBUG
+       cerr << __FILE__ <<  ": get_connected()" << endl;
+#endif // DEBUG
+       TCPServer::ConnectionInfoList con;
+       Glib::Mutex::Lock lock(connections_mutex);
+       for (ConnectionList::const_iterator i = connections.begin();
+                       i != connections.end(); i++) {
+               TCPServer::ConnectionInfo ci =
+                       { (*i)->get_peerhost(), (*i)->get_peerport() };
+               con.push_back(ci);
+       }
+       return con;
+}
+
 } // namespace Server
 
 } // namespace PlaQui
 } // namespace Server
 
 } // namespace PlaQui