summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOthmar Gsenger <otti@anytun.org>2008-02-28 20:33:46 +0000
committerOthmar Gsenger <otti@anytun.org>2008-02-28 20:33:46 +0000
commit2dd4b9e3a34c3c94fd475de7472e7244e83a48fa (patch)
treef4a13055c9b4672138344dd45488018229acc69b
parentremoved newlines from muxsocket (diff)
sync fixes
-rw-r--r--anyctr.cpp5
-rw-r--r--syncClientSocket.cpp12
-rw-r--r--syncClientSocket.h6
3 files changed, 17 insertions, 6 deletions
diff --git a/anyctr.cpp b/anyctr.cpp
index 51b79aa..5eb8add 100644
--- a/anyctr.cpp
+++ b/anyctr.cpp
@@ -89,8 +89,11 @@ void createConnection(const std::string & remote_host, u_int16_t remote_port, Co
const SyncCommand scom(cl,mux);
const SyncCommand scom2 (prefix);
oa << scom;
- oa << scom2;
std::cout << sout.str() << std::endl;
+ std::ostringstream sout2;
+ boost::archive::text_oarchive oa2(sout2);
+ oa2 << scom2;
+ std::cout << sout2.str() << std::endl;
}
int main(int argc, char* argv[])
diff --git a/syncClientSocket.cpp b/syncClientSocket.cpp
index 734ff6e..40954c4 100644
--- a/syncClientSocket.cpp
+++ b/syncClientSocket.cpp
@@ -42,17 +42,19 @@ void SyncClientSocket::OnReconnect()
void SyncClientSocket::OnRawData(const char *buf,size_t len)
//void SyncClientSocket::OnLine(const std::string& line)
{
- std::stringstream iss;
cLog.msg(Log::PRIO_NOTICE) << "recieved sync inforamtaion from " << GetRemoteHostname() << std::endl;
for(size_t index=0;index<len;index++)
{
std::cout << buf[index];
- iss << buf[index];
+ iss_ << buf[index];
}
- boost::archive::text_iarchive ia(iss);
- SyncCommand scom(cl_);
- ia >> scom;
+ while(!iss_.fail())
+ {
+ boost::archive::text_iarchive ia(iss_);
+ SyncCommand scom(cl_);
+ ia >> scom;
+ }
//u_int16_t mux = scom.getMux();
//const ConnectionParam & conn = cl_.getConnection(mux)->second;
//cLog.msg(Log::PRIO_NOTICE) << "sync connection #"<<mux<<" remote host " << conn.remote_host_ << ":" << conn.remote_port_ << std::endl;
diff --git a/syncClientSocket.h b/syncClientSocket.h
index 17dd518..1909ebb 100644
--- a/syncClientSocket.h
+++ b/syncClientSocket.h
@@ -5,6 +5,11 @@
#include "Sockets/ISocketHandler.h"
#include "connectionList.h"
#include "syncCommand.h"
+#include <sstream>
+#include <iostream>
+#include <string>
+
+
#ifdef SOCKETS_NAMESPACE
using namespace SOCKETS_NAMESPACE;
@@ -20,6 +25,7 @@ public:
void OnRawData(const char *buf,size_t len);
private:
ConnectionList & cl_;
+ std::stringstream iss_;
};