case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("ABC");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("ABC");
- // close the connection
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
+
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("ABC");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("ABC");
+
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
- // close the connection
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("ABC");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("ABC");
- // close the connection
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
+
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("1");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("1");
+
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
- sc.write("2");
+ sc.write("2");
- // close the connection
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- // max 3 sec
- for (int i=0; i < 3; i++)
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
- if(ss.get_packet(data,cid))
- break;
+ // max 3 sec
+ for (int i=0; i < 3; i++)
+ {
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+ if(ss.get_packet(data,cid))
+ break;
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
-
- // max 3 sec
- for (int i=0; i < 3; i++)
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
- if(ss.get_packet(data,cid))
- break;
+ // max 3 sec
+ for (int i=0; i < 3; i++)
+ {
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+ if(ss.get_packet(data,cid))
+ break;
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
- group_command_server<cmd_group_a> cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ group_command_server<cmd_group_a> cs(ss);
- // max 10 sec
- for (int i=0; i < 10; i++)
- cs.handle(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ cs.handle(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
- group_command_server<cmd_group_b> cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ group_command_server<cmd_group_b> cs(ss);
- // max 10 sec
- for (int i=0; i < 10; i++)
- cs.handle(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ cs.handle(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- // wait till server is up
- sleep(1);
- socket_client_connection sc("./socket");
- sc.write("hello");
+ try
+ {
+ // wait till server is up
+ sleep(1);
+ socket_client_connection sc("./socket");
+ sc.write("hello");
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- if (data=="QUIT")
- break;
+ string data;
+ unsigned int cid;
- if (data=="ABC")
- con->write("DEF");
- else
- con->write("xyz");
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
+
+ if (data=="QUIT")
+ break;
+
+ if (data=="ABC")
+ con->write("DEF");
+ else
+ con->write("xyz");
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- if (data=="QUIT")
- break;
+ string data;
+ unsigned int cid;
- con->write(string().insert(0,100*1024,'y'));
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
+
+ if (data=="QUIT")
+ break;
+
+ con->write(string().insert(0,100*1024,'y'));
+ }
}
+ std::cerr << "child: OVER" << std::endl;
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
- std::cerr << "child: OVER" << std::endl;
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- // wait till server is up
- sleep(1);
- socket_client_connection sc(6666);
- sc.write("hello");
+ try
+ {
+ // wait till server is up
+ sleep(1);
+ socket_client_connection sc(6666);
+ sc.write("hello");
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss(6666);
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss(6666);
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
- if (data=="QUIT")
- break;
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- if (data=="ABC")
- con->write("DEF");
- else
- con->write("xyz");
+ if (data=="QUIT")
+ break;
+
+ if (data=="ABC")
+ con->write("DEF");
+ else
+ con->write("xyz");
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss(6666);
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss(6666);
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- socket_handler* alias= dynamic_cast< socket_handler* >(con);
+ string data;
+ unsigned int cid;
- if (data=="QUIT")
- break;
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- alias->set_write_block_size( 4093 );
- con->write(string().insert(0,2048*1024,'y'));
+ socket_handler* alias= dynamic_cast< socket_handler* >(con);
+
+ if (data=="QUIT")
+ break;
+
+ alias->set_write_block_size( 4093 );
+ con->write(string().insert(0,2048*1024,'y'));
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ ostringstream hello;
+ hello << "T2Nv" << PROTOCOL_VERSION << ';';
+ int byteordercheck=1;
+ hello.write((char*)&byteordercheck,sizeof(byteordercheck));
+ hello << ';';
+
+ ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- ostringstream hello;
- hello << "T2Nv" << PROTOCOL_VERSION << ';';
- int byteordercheck=1;
- hello.write((char*)&byteordercheck,sizeof(byteordercheck));
- hello << ';';
-
- ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
-
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
- ostringstream hello;
- hello << "XYZ 123";
+ ostringstream hello;
+ hello << "XYZ 123";
- ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+ ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
-
- ostringstream hello;
- // lets hope we don't ever get near such a version number...
- hello << "T2Nv" << 4982271 << ';';
- int byteordercheck=1;
- hello.write((char*)&byteordercheck,sizeof(byteordercheck));
- hello << ';';
+ try
+ {
+ socket_server ss("./socket");
+
+ ostringstream hello;
+ // lets hope we don't ever get near such a version number...
+ hello << "T2Nv" << 4982271 << ';';
+ int byteordercheck=1;
+ hello.write((char*)&byteordercheck,sizeof(byteordercheck));
+ hello << ';';
+
+ ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
-
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
-
- ostringstream hello;
- hello << "T2Nv" << PROTOCOL_VERSION;
- int byteordercheck=1;
- hello.write((char*)&byteordercheck,sizeof(byteordercheck));
- hello << ';';
-
- ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+ try
+ {
+ socket_server ss("./socket");
+
+ ostringstream hello;
+ hello << "T2Nv" << PROTOCOL_VERSION;
+ int byteordercheck=1;
+ hello.write((char*)&byteordercheck,sizeof(byteordercheck));
+ hello << ';';
+
+ ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ ostringstream hello;
+ hello << "T2Nv" << PROTOCOL_VERSION << ';';
+ int byteordercheck=1;
+ int dst;
+ char* si=(char*)&byteordercheck;
+ char* di=(char*)&dst;
+
+ di[0]=si[3];
+ di[1]=si[2];
+ di[2]=si[1];
+ di[3]=si[0];
+
+ hello.write((char*)&dst,sizeof(dst));
+ hello << ';';
+
+ ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- ostringstream hello;
- hello << "T2Nv" << PROTOCOL_VERSION << ';';
- int byteordercheck=1;
- int dst;
- char* si=(char*)&byteordercheck;
- char* di=(char*)&dst;
-
- di[0]=si[3];
- di[1]=si[2];
- di[2]=si[1];
- di[3]=si[0];
-
- hello.write((char*)&dst,sizeof(dst));
- hello << ';';
-
- ss.add_callback(new_connection,bind(&test_hello::send_hello, boost::ref(*this), hello.str(),&ss, _1));
-
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ ostringstream hello;
+ // hmm, we got the wrong socket
+ hello << "* OK intradev.net.lan Cyrus IMAP4 v2.2.13 server ready";
- ostringstream hello;
- // hmm, we got the wrong socket
- hello << "* OK intradev.net.lan Cyrus IMAP4 v2.2.13 server ready";
+ ss.add_callback(new_connection,bind(&test_hello::send_raw_socket, boost::ref(*this), hello.str(),&ss, _1));
- ss.add_callback(new_connection,bind(&test_hello::send_raw_socket, boost::ref(*this), hello.str(),&ss, _1));
+ // max 3 sec
+ for (int i=0; i < 3; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 3 sec
- for (int i=0; i < 3; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ ostringstream hello;
+ // hmm, we got the wrong socket
+ hello << "READY";
- ostringstream hello;
- // hmm, we got the wrong socket
- hello << "READY";
+ ss.add_callback(new_connection,bind(&test_hello::send_raw_socket, boost::ref(*this), hello.str(),&ss, _1));
- ss.add_callback(new_connection,bind(&test_hello::send_raw_socket, boost::ref(*this), hello.str(),&ss, _1));
+ // max 3 sec
+ for (int i=0; i < 3; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 3 sec
- for (int i=0; i < 3; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
+ try
{
- socket_server ss("./socket");
- command_server cs(ss);
-
- // handle new connection and just one command
- cs.handle(10000000);
- cs.handle(10000000);
- }
- // close socket, create new one
+ {
+ socket_server ss("./socket");
+ command_server cs(ss);
+
+ // handle new connection and just one command
+ cs.handle(10000000);
+ cs.handle(10000000);
+ }
+ // close socket, create new one
+ {
+ socket_server ss("./socket");
+ ss.set_logging(&cerr,debug);
+ command_server cs(ss);
+
+ // max 30 sec
+ for (int i=0; i < 30; i++)
+ cs.handle(1000000);
+ }
+ } catch(...)
{
- socket_server ss("./socket");
- ss.set_logging(&cerr,debug);
- command_server cs(ss);
-
- // max 30 sec
- for (int i=0; i < 30; i++)
- cs.handle(1000000);
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- if (data=="QUIT")
- break;
+ if (data=="QUIT")
+ break;
- if (data=="x")
- con->write(string().insert(0,100,'X'));
- else
- con->write(string().insert(0,100,'Y'));
+ if (data=="x")
+ con->write(string().insert(0,100,'X'));
+ else
+ con->write(string().insert(0,100,'Y'));
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- if (data=="QUIT")
- break;
+ string data;
+ unsigned int cid;
- if (data=="x")
- con->write(string().insert(0,100,'X'));
- else
- con->write(string().insert(0,100,'Y'));
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
+
+ if (data=="QUIT")
+ break;
+
+ if (data=="x")
+ con->write(string().insert(0,100,'X'));
+ else
+ con->write(string().insert(0,100,'Y'));
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- if (data=="QUIT")
- break;
+ if (data=="QUIT")
+ break;
- if (data=="x")
- con->write(string().insert(0,100,'X'));
+ if (data=="x")
+ con->write(string().insert(0,100,'X'));
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- if (data=="QUIT")
- break;
+ string data;
+ unsigned int cid;
- if (data=="x")
+ if(ss.get_packet(data,cid))
{
- for (int i=0; i<packets; i++)
- con->write(string().insert(0,100,'X'));
+ server_connection* con=ss.get_connection(cid);
+
+ if (data=="QUIT")
+ break;
+
+ if (data=="x")
+ {
+ for (int i=0; i<packets; i++)
+ con->write(string().insert(0,100,'X'));
+ }
}
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- if (data=="QUIT")
- break;
+ string data;
+ unsigned int cid;
- if (data=="x")
+ if(ss.get_packet(data,cid))
{
- con->write(string().insert(0,100,'X'));
- send_raw_socket("aaaab",&ss,cid);
+ server_connection* con=ss.get_connection(cid);
+
+ if (data=="QUIT")
+ break;
+
+ if (data=="x")
+ {
+ con->write(string().insert(0,100,'X'));
+ send_raw_socket("aaaab",&ss,cid);
+ }
}
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- if (data=="QUIT")
- break;
+ string data;
+ unsigned int cid;
- if (data=="x")
+ if(ss.get_packet(data,cid))
{
- con->write(string().insert(0,100,'X'));
+ server_connection* con=ss.get_connection(cid);
+
+ if (data=="QUIT")
+ break;
- string blob=string().insert(0,100,'Y');
+ if (data=="x")
+ {
+ con->write(string().insert(0,100,'X'));
+
+ string blob=string().insert(0,100,'Y');
- // one byte will be missing...
- int size=blob.size()+1;
- char sizetransfer[sizeof(int)+1];
- memcpy(sizetransfer,(void*)&size,sizeof(int));
- sizetransfer[sizeof(int)+1]=0;
+ // one byte will be missing...
+ int size=blob.size()+1;
+ char sizetransfer[sizeof(int)+1];
+ memcpy(sizetransfer,(void*)&size,sizeof(int));
+ sizetransfer[sizeof(int)+1]=0;
- string packet=string(sizetransfer)+blob;
+ string packet=string(sizetransfer)+blob;
- send_raw_socket(packet,&ss,cid);
+ send_raw_socket(packet,&ss,cid);
+ }
}
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
} catch (exception &e)
{
cerr << "caught exception: " << e.what() << endl;
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
- command_server cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ command_server cs(ss);
- // max 10 sec
- for (int i=0; i < 10; i++)
- cs.handle(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ cs.handle(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
- command_server cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ command_server cs(ss);
- // max 10 sec
- for (int i=0; i < 10; i++)
- cs.handle(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ cs.handle(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
- command_server cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ command_server cs(ss);
- // max 10 sec
- for (int i=0; i < 10; i++)
- cs.handle(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ cs.handle(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
- command_server cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ command_server cs(ss);
- // max 10 sec
- for (int i=0; i < 10; i++)
- cs.handle(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ cs.handle(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
- command_server cs(ss);
+ try
+ {
+ socket_server ss("./socket");
+ command_server cs(ss);
- // max 60 sec - we need atleast 28 handle calls to transfer the buffer
- for (int i=0; i < 60; i++) {
- cs.handle(1000000);
+ // max 60 sec - we need atleast 28 handle calls to transfer the buffer
+ for (int i=0; i < 60; i++) {
+ cs.handle(1000000);
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
- // create a valid packet
- ostringstream hello;
- hello << "T2Nv" << PROTOCOL_VERSION << ';';
- int byteordercheck=1;
- hello.write((char*)&byteordercheck,sizeof(byteordercheck));
- hello << ';';
+ // create a valid packet
+ ostringstream hello;
+ hello << "T2Nv" << PROTOCOL_VERSION << ';';
+ int byteordercheck=1;
+ hello.write((char*)&byteordercheck,sizeof(byteordercheck));
+ hello << ';';
- packet_size_indicator psize=htonl(hello.str().size());
- std::string send_data(hello.str());
- send_data.insert(0,(char*)&psize,sizeof(packet_size_indicator));
+ packet_size_indicator psize=htonl(hello.str().size());
+ std::string send_data(hello.str());
+ send_data.insert(0,(char*)&psize,sizeof(packet_size_indicator));
- ss.add_callback(new_connection,bind(&test_timeout::send_slow_raw_socket, boost::ref(*this), send_data,&ss, _1));
+ ss.add_callback(new_connection,bind(&test_timeout::send_slow_raw_socket, boost::ref(*this), send_data,&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
- ostringstream hello;
- hello << "T2Nv" << PROTOCOL_VERSION << ';';
- int byteordercheck=1;
- hello.write((char*)&byteordercheck,sizeof(byteordercheck));
- hello << ';';
+ ostringstream hello;
+ hello << "T2Nv" << PROTOCOL_VERSION << ';';
+ int byteordercheck=1;
+ hello.write((char*)&byteordercheck,sizeof(byteordercheck));
+ hello << ';';
- ss.add_callback(new_connection,bind(&test_timeout::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+ ss.add_callback(new_connection,bind(&test_timeout::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
- ostringstream hello;
- hello << "T2Nv" << PROTOCOL_VERSION << ';';
- int byteordercheck=1;
- hello.write((char*)&byteordercheck,sizeof(byteordercheck));
- hello << ';';
+ ostringstream hello;
+ hello << "T2Nv" << PROTOCOL_VERSION << ';';
+ int byteordercheck=1;
+ hello.write((char*)&byteordercheck,sizeof(byteordercheck));
+ hello << ';';
- ss.add_callback(new_connection,bind(&test_timeout::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+ ss.add_callback(new_connection,bind(&test_timeout::send_hello, boost::ref(*this), hello.str(),&ss, _1));
- // max 10 sec
- for (int i=0; i < 10; i++)
- {
- ss.fill_buffer(1000000);
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ {
+ ss.fill_buffer(1000000);
- string data;
- unsigned int cid;
+ string data;
+ unsigned int cid;
- if(ss.get_packet(data,cid))
- {
- // create a valid packet & send
- string response="abcdefghijklmnopqrstuvwxyz";
- packet_size_indicator psize=htonl(response.size());
- std::string send_data(response);
- send_data.insert(0,(char*)&psize,sizeof(packet_size_indicator));
- send_slow_raw_socket(send_data,&ss,cid);
+ if(ss.get_packet(data,cid))
+ {
+ // create a valid packet & send
+ string response="abcdefghijklmnopqrstuvwxyz";
+ packet_size_indicator psize=htonl(response.size());
+ std::string send_data(response);
+ send_data.insert(0,(char*)&psize,sizeof(packet_size_indicator));
+ send_slow_raw_socket(send_data,&ss,cid);
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ // bail out as soon as we get something
+ ss.fill_buffer(-1);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // bail out as soon as we get something
- ss.fill_buffer(-1);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
+
+ // bail out as soon as we get something
+ ss.fill_buffer(-1);
+ ss.fill_buffer(-1);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // bail out as soon as we get something
- ss.fill_buffer(-1);
- ss.fill_buffer(-1);
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- // wait till server is up
- sleep(1);
+ try
+ {
+ // wait till server is up
+ sleep(1);
- socket_client_connection sc("./socket");
+ socket_client_connection sc("./socket");
- // this is an evil hack to get access to real_write, don't ever do this in an app!!!
- real_write_client_connection *rwc=(real_write_client_connection*)≻
- rwc->real_write(string(10000,'x'));
+ // this is an evil hack to get access to real_write, don't ever do this in an app!!!
+ real_write_client_connection *rwc=(real_write_client_connection*)≻
+ rwc->real_write(string(10000,'x'));
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_client_connection *sc=new socket_client_connection("./socket");
- sc->write(string(10000,'x'));
- delete sc;
- // socket is closed regularly
+ try
+ {
+ socket_client_connection *sc=new socket_client_connection("./socket");
+ sc->write(string(10000,'x'));
+ // socket is closed regularly
+ delete sc;
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't run regular cleanup, otherwise cppunit stuff gets called
_exit(0);
case 0:
// child
{
- // wait till server is really up and waiting
- sleep(2);
+ try
+ {
+ // wait till server is really up and waiting
+ sleep(2);
- // connect with very tight timeout and only 1 retry
- socket_client_connection sc("./socket",50,1);
+ // connect with very tight timeout and only 1 retry
+ socket_client_connection sc("./socket",50,1);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_client_connection *sc=new socket_client_connection("./socket");
- sc->write(string(10000,'x'));
- delete sc;
- // socket is closed regularly
+ try
+ {
+ socket_client_connection *sc=new socket_client_connection("./socket");
+ sc->write(string(10000,'x'));
+ delete sc;
+ // socket is closed regularly
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
// don't run regular cleanup, otherwise cppunit stuff gets called
_exit(0);
case 0:
// child
{
- int i=0;
- while(i < 10 && !kill_server)
+ try
{
- close_server=false;
-
- socket_server ss("./socket");
- group_command_server<cmd_group_x> cs(ss);
- ss.set_logging(&logstream,debug);
-
- // max 10 sec
- for (; !close_server && !kill_server && i < 10; i++)
- cs.handle(1000000);
+ int i=0;
+ while(i < 10 && !kill_server)
+ {
+ close_server=false;
+
+ socket_server ss("./socket");
+ group_command_server<cmd_group_x> cs(ss);
+ ss.set_logging(&logstream,debug);
+
+ // max 10 sec
+ for (; !close_server && !kill_server && i < 10; i++)
+ cs.handle(1000000);
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- int i=0;
- while(i < 10 && !kill_server)
+ try
{
- close_server=false;
-
- socket_server ss("./socket");
- group_command_server<cmd_group_x> cs(ss);
- ss.set_logging(&logstream,debug);
-
- // max 10 sec
- for (; !close_server && !kill_server && i < 10; i++)
- cs.handle(1000000);
+ int i=0;
+ while(i < 10 && !kill_server)
+ {
+ close_server=false;
+
+ socket_server ss("./socket");
+ group_command_server<cmd_group_x> cs(ss);
+ ss.set_logging(&logstream,debug);
+
+ // max 10 sec
+ for (; !close_server && !kill_server && i < 10; i++)
+ cs.handle(1000000);
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
+ try
+ {
+ socket_server ss("./socket");
- // server sends garbage
+ // server sends garbage
- ostringstream hello;
- hello << "XYZ 123";
+ ostringstream hello;
+ hello << "XYZ 123";
- ss.add_callback(new_connection,bind(&test_wrapper_noserver::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+ ss.add_callback(new_connection,bind(&test_wrapper_noserver::send_hello, boost::ref(*this), hello.str(),&ss, _1));
+
+ // max 10 sec
+ for (int i=0; i < 10; i++)
+ ss.fill_buffer(1000000);
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
- // max 10 sec
- for (int i=0; i < 10; i++)
- ss.fill_buffer(1000000);
// don't call atexit and stuff
_exit(0);
}