summaryrefslogtreecommitdiff
path: root/i/marvin/src/log
diff options
context:
space:
mode:
authorhaller2006-05-07 21:39:58 +0000
committerhaller2006-05-07 21:39:58 +0000
commitc768e610aa4ec4cbd11a919e65ee984d8d71b868 (patch)
tree61db04f7f2ed58ddebc57e385eac4a4e43c9d3f3 /i/marvin/src/log
parent5a534ef4253328eec26acfabc8d8cbcb5641b67c (diff)
* Amélioration de socket_client
* Codage du server_log en lui faisant manger des DataInput
Diffstat (limited to 'i/marvin/src/log')
-rw-r--r--i/marvin/src/log/log_server.cc20
-rw-r--r--i/marvin/src/log/log_server.hh8
2 files changed, 17 insertions, 11 deletions
diff --git a/i/marvin/src/log/log_server.cc b/i/marvin/src/log/log_server.cc
index bba80f5..126ed66 100644
--- a/i/marvin/src/log/log_server.cc
+++ b/i/marvin/src/log/log_server.cc
@@ -23,26 +23,32 @@
//
// }}}
#include "log_server.hh"
-#include "socket/socket_databuffer.hh"
+#include "socket/socket_client.hh"
-LogServer::LogServer(DataBuffer & db, const Address & address)
- :ss_(address),db_(db)
+LogServer::LogServer(DataInput & di, const Address & address)
+ :ss_(address),di_(di)
{
}
-LogServer::LogServer(DataBuffer & db, const std::string & address,
+LogServer::LogServer(DataInput & di, const std::string & address,
int port)
- :ss_(address, port),db_(db)
+ :ss_(address, port),di_(di)
{
}
void
LogServer::listen(void)
{
+ int charBuffer;
+
+ const unsigned BUFFER_SIZE = 256;
+ // Buffer de taille completement arbitraire
+ uint8_t buffer[BUFFER_SIZE];
// Ouvre les oreilles du socket
ss_.listen(1);
// Attend gentillement une connection
- SocketDataBuffer sdb(ss_);
+ SocketClient sc(ss_);
// Paf on envoie la sauce
- sdb.write(db_);
+ while((charBuffer = di_.read(buffer, BUFFER_SIZE)) != 0)
+ sc.write(buffer, charBuffer);
}
diff --git a/i/marvin/src/log/log_server.hh b/i/marvin/src/log/log_server.hh
index c9b9cf5..a18de15 100644
--- a/i/marvin/src/log/log_server.hh
+++ b/i/marvin/src/log/log_server.hh
@@ -26,7 +26,7 @@
// }}}
#include "socket/socket_server.hh"
-#include "data/data_buffer.hh"
+#include "data/data_input.hh"
/// Classe pour récupérer les logs.
/// La classe construit un serveur en fin de match pour pouvoir récupérer les
@@ -37,12 +37,12 @@ class LogServer
/// La socket serveur qui attend la ze connection
SocketServer ss_;
/// La dataBuffer à transmettre (avec les logs dedans c'est mieux)
- DataBuffer & db_;
+ DataInput & di_;
public:
/// Constructeur
- LogServer(DataBuffer & db, const Address & address);
+ LogServer(DataInput & di, const Address & address);
/// Constructeur
- LogServer(DataBuffer & db, const std::string & address, int port);
+ LogServer(DataInput & di, const std::string & address, int port);
/// Mise en écoute du serveur
void listen(void);
};