Reconstructed release dates in ChangeLog
[libt2n] / test / callback.cpp
index 257da83..60c9058 100644 (file)
@@ -83,20 +83,26 @@ class test_callback : public TestFixture
             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
@@ -142,20 +148,26 @@ class test_callback : public TestFixture
             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
@@ -201,20 +213,26 @@ class test_callback : public TestFixture
             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
@@ -263,22 +281,28 @@ class test_callback : public TestFixture
             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
@@ -344,18 +368,25 @@ class test_callback : public TestFixture
             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);
             }
@@ -396,18 +427,25 @@ class test_callback : public TestFixture
             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);
             }