X-Git-Url: https://git.syn-net.org/debian/?a=blobdiff_plain;f=src%2FsyncQueue.cpp;h=8ddc7437f890a7e71031bff508df0c9a449411d1;hb=bd02a5f6be4815d46524d613f727199ca756c971;hp=636107b7f21a82c8c6fc1d2008d5a5b1b96de3d7;hpb=058ae090a970436caec3b3059e9e18b310dd6b0d;p=anytun.git diff --git a/src/syncQueue.cpp b/src/syncQueue.cpp index 636107b..8ddc743 100644 --- a/src/syncQueue.cpp +++ b/src/syncQueue.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -51,39 +52,41 @@ SyncQueue& SyncQueue::instance() { Lock lock(instMutex); static instanceCleaner c; - if(!inst) + if(!inst) { inst = new SyncQueue(); + } return *inst; } -void SyncQueue::push(const SyncCommand & scom ) +void SyncQueue::push(const SyncCommand& scom) { - std::ostringstream sout; - boost::archive::text_oarchive oa(sout); - oa << scom; + std::ostringstream sout; + boost::archive::text_oarchive oa(sout); + oa << scom; std::stringstream lengthout; lengthout << std::setw(5) << std::setfill('0') << sout.str().size()<< ' '; - push(lengthout.str()+sout.str()); + push(lengthout.str()+sout.str()); } -void SyncQueue::push(const std::string & str ) +void SyncQueue::push(const std::string& str) { Lock lock(mutex_); -// std::cout << "Debug" << std:endl; - if( syncServer_) - syncServer_->send(str); + // std::cout << "Debug" << std:endl; + if(syncServer_) { + syncServer_->send(str); + } } -void SyncQueue::setSyncServerPtr(SyncServer * ptr) +void SyncQueue::setSyncServerPtr(SyncServer* ptr) { Lock lock(mutex_); - syncServer_=ptr; + syncServer_=ptr; } bool SyncQueue::empty() { Lock lock(mutex_); - return 1; + return 1; }