diff options
author | Dwight <dmerriman@gmail.com> | 2007-11-18 14:05:28 -0500 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2007-11-18 14:05:28 -0500 |
commit | e3c947f118a40c6136d6f355736814b043090dda (patch) | |
tree | b233fa9ac10ada7d5af364c3821aff92d8366479 /grid | |
parent | a07fb60cd482a217a57ab72fc7c52f8732273efd (diff) | |
download | mongo-e3c947f118a40c6136d6f355736814b043090dda.tar.gz |
cleaner output
Diffstat (limited to 'grid')
-rw-r--r-- | grid/protoimpl.h | 13 | ||||
-rw-r--r-- | grid/protorecv.cpp | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/grid/protoimpl.h b/grid/protoimpl.h index 02691e623c4..26eeed8f336 100644 --- a/grid/protoimpl.h +++ b/grid/protoimpl.h @@ -4,6 +4,11 @@ #include "message.h"
+using namespace boost;
+typedef boost::mutex::scoped_lock lock;
+
+extern boost::mutex coutmutex;
+
const int FragMax = 1480;
const int FragHeader = 10;
const int MSS = FragMax - FragHeader;
@@ -71,6 +76,7 @@ inline void DUMPDATA(Fragment& f, const char *tabs) { }
inline void SEND(UDPConnection& c, Fragment &f, SockAddr& to, const char *extra="") {
+ lock lk(coutmutex);
DUMP(f, to, "\t\t\t\t\t>");
c.sendto((char *) &f, f.fragmentLen, to);
cout << extra;
@@ -152,8 +158,11 @@ inline F* __recv(UDPConnection& c, SockAddr& from) { cout << ".recvfrom returned error " << getLastError() << " socket:" << c.sock << endl;
}
assert( f->fragmentLen == n );
- DUMP(*f, from, "\t\t\t\t\t\t\t\t\t\t<");
- DUMPDATA(*f, "\t\t\t\t\t\t\t\t\t\t ");
+ {
+ lock lk(coutmutex);
+ DUMP(*f, from, "\t\t\t\t\t\t\t\t\t\t<");
+ DUMPDATA(*f, "\t\t\t\t\t\t\t\t\t\t ");
+ }
return new F(f);
}
diff --git a/grid/protorecv.cpp b/grid/protorecv.cpp index 0d55909ab07..8cd613954a8 100644 --- a/grid/protorecv.cpp +++ b/grid/protorecv.cpp @@ -7,9 +7,7 @@ #include "../util/sock.h"
#include "protoimpl.h"
-using namespace boost;
-typedef boost::mutex::scoped_lock lock;
-
+boost::mutex coutmutex;
boost::mutex mutexr;
boost::condition threadActivate; // creating a new thread, grabbing threadUseThisOne
ProtocolConnection *threadUseThisOne = 0;
|