summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile4
-rw-r--r--src/syncServer.cpp2
-rw-r--r--src/syncServer.h4
3 files changed, 7 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile
index 8dee124..552b8f1 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -124,8 +124,8 @@ anytun: $(OBJS) $(SYNCOBJS) anytun.o
anytun-nosync: $(OBJS) anytun-nosync.o
$(LD) $(OBJS) anytun-nosync.o -o $@ $(LDFLAGS)
-anytun-showtables: $(OBJS) anytun-showtables.o
- $(LD) $(OBJS) anytun-showtables.o -o $@ $(LDFLAGS)
+anytun-showtables: $(OBJS) $(SYNCOBJS) anytun-showtables.o
+ $(LD) $(OBJS) $(SYNCOBJS) anytun-showtables.o -o $@ $(LDFLAGS)
anytun-config: $(ANYCONFOBJS) anytun-config.o
$(LD) $(ANYCONFOBJS) anytun-config.o -o $@ $(LDFLAGS)
diff --git a/src/syncServer.cpp b/src/syncServer.cpp
index 1468d74..b2e4cf8 100644
--- a/src/syncServer.cpp
+++ b/src/syncServer.cpp
@@ -10,6 +10,7 @@ SyncServer::SyncServer(asio::io_service& io_service, asio::ip::tcp::endpoint tcp
void SyncServer::start_accept()
{
+ Lock lock(mutex_);
SyncTcpConnection::pointer new_connection =
SyncTcpConnection::create(acceptor_.io_service());
conns_.push_back(new_connection);
@@ -21,6 +22,7 @@ void SyncServer::start_accept()
void SyncServer::send(std::string message)
{
+ Lock lock(mutex_);
for(std::list<SyncTcpConnection::pointer>::iterator it = conns_.begin() ;it != conns_.end(); ++it) {
(*it)->Send(message);
}
diff --git a/src/syncServer.h b/src/syncServer.h
index 092ad16..d7317db 100644
--- a/src/syncServer.h
+++ b/src/syncServer.h
@@ -6,6 +6,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/function.hpp>
+#include "threadUtils.hpp"
+
#include <asio.hpp>
#include <list>
@@ -24,7 +26,7 @@ private:
void start_accept();
void handle_accept(SyncTcpConnection::pointer new_connection,
const asio::error_code& error);
-
+ Mutex mutex_; //Mutex for list conns_
asio::ip::tcp::acceptor acceptor_;
};
#endif