From 184e15f0eedd1a3895987e59f5d39fad19c3b9b6 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 17 Nov 2003 03:04:56 +0000 Subject: [PATCH] Se agrega un parametro *provisorio* body a la signal_ok_received para obtener el cuerpo del mensaje. Se corrige el port y host para que una vez que se conecta devuelva el host y port local (en vez de a donde nos conectamos). --- Server/include/plaqui/server/controlclient.h | 2 +- Server/src/controlclient.cpp | 4 +++- Server/tests/client_test.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Server/include/plaqui/server/controlclient.h b/Server/include/plaqui/server/controlclient.h index 66af2ea..50ebe2a 100644 --- a/Server/include/plaqui/server/controlclient.h +++ b/Server/include/plaqui/server/controlclient.h @@ -47,7 +47,7 @@ namespace Server { typedef SigC::Signal0 SignalConnected; /// Tipo de señal para indicar que se recibió una respuesta OK. - typedef SigC::Signal0 SignalOKReceived; + typedef SigC::Signal1 SignalOKReceived; /// Tipo de señal para indicar que se recibió un error. typedef SigC::Signal1 SignalErrorReceived; diff --git a/Server/src/controlclient.cpp b/Server/src/controlclient.cpp index f33fff5..07c8680 100644 --- a/Server/src/controlclient.cpp +++ b/Server/src/controlclient.cpp @@ -63,6 +63,8 @@ void ControlClient::real_run(void) { finish(); return; } + host = socket->peerhost(); + port = socket->peerport(); // TODO sacar a la mierda? connected(); while (!stop) { @@ -85,7 +87,7 @@ void ControlClient::real_run(void) { } switch (response.status_code) { case HTTPMessage::OK: - ok_received(); + ok_received(response.get_body()); break; default: error_received(response.status_code); diff --git a/Server/tests/client_test.cpp b/Server/tests/client_test.cpp index 4605619..2bf118a 100644 --- a/Server/tests/client_test.cpp +++ b/Server/tests/client_test.cpp @@ -46,8 +46,9 @@ void on_connected(void) { cout << " Conectado! :-)" << endl; } -void on_ok_received(void) { +void on_ok_received(const string& body) { cout << " Respuesta recibida: OK! :-D" << endl; + cout << " Body: " << body << endl; } void on_error_received(unsigned code) { -- 2.43.0