mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
cleaner output
This commit is contained in:
parent
a07fb60cd4
commit
e3c947f118
16
db/db.cpp
16
db/db.cpp
@ -224,15 +224,15 @@ void run() {
|
||||
m.reset();
|
||||
|
||||
// temp:
|
||||
sleepsecs(1);
|
||||
// sleepsecs(1);
|
||||
|
||||
cout << '\n' << curTimeMillis() << " waiting for msg..." << endl;
|
||||
cout << curTimeMillis() % 10000 << " waiting for msg..." << endl;
|
||||
if( !dbMsgPort.recv(m) ) {
|
||||
cout << "MessagingPort::recv() returned false" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
cout << '\n' << curTimeMillis() << " **** db.cpp got msg ************\n" << endl;
|
||||
cout << curTimeMillis() % 10000 << " db.cpp got msg" << endl;
|
||||
|
||||
//cout << " got msg" << endl;
|
||||
//cout << " op:" << m.data->operation << " len:" << m.data->len << endl;
|
||||
@ -241,7 +241,7 @@ void run() {
|
||||
char *p = m.data->_data;
|
||||
int len = strlen(p);
|
||||
if( len > 400 )
|
||||
cout << curTimeMillis() <<
|
||||
cout << curTimeMillis() % 10000 <<
|
||||
" long msg received, len:" << len <<
|
||||
" ends with: " << p + len - 10 << endl;
|
||||
bool end = strcmp("end", p) == 0;
|
||||
@ -249,7 +249,7 @@ void run() {
|
||||
resp.setData(opReply, "i am fine");
|
||||
dbMsgPort.reply(m, resp);
|
||||
if( end ) {
|
||||
cout << curTimeMillis() << " end msg" << endl;
|
||||
cout << curTimeMillis() % 10000 << " end msg" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -290,9 +290,9 @@ void msg(const char *m, int extras = 0) {
|
||||
for( int i = 0; i < extras; i++ )
|
||||
p.say(p.channel(), db, send);
|
||||
|
||||
cout << curTimeMillis() << " ****calling DB..." << endl;
|
||||
cout << curTimeMillis() % 10000 << " ****calling DB..." << endl;
|
||||
bool ok = p.call(db, send, response);
|
||||
cout << curTimeMillis() << " ****ok. response.data:" << ok << " ****" << endl;
|
||||
cout << curTimeMillis() % 10000 << " ****ok. response.data:" << ok << " ****" << endl;
|
||||
/* cout << " " << response.data->id << endl;
|
||||
cout << " " << response.data->len << endl;
|
||||
cout << " " << response.data->operation << endl;
|
||||
@ -311,7 +311,7 @@ cout << "hello2" << endl;
|
||||
int main(int argc, char* argv[], char *envp[] )
|
||||
{
|
||||
srand(curTimeMillis());
|
||||
cout << curTimeMillis() << endl;
|
||||
cout << curTimeMillis() % 10000 << endl;
|
||||
|
||||
quicktest();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user