]> git.mxchange.org Git - simgear.git/commitdiff
Fix HTTP tests build.
authorJames Turner <zakalawe@mac.com>
Sun, 9 Jun 2013 22:45:43 +0000 (23:45 +0100)
committerJames Turner <zakalawe@mac.com>
Sun, 9 Jun 2013 22:45:43 +0000 (23:45 +0100)
simgear/io/test_HTTP.cxx

index b9207c7a431398117036bd9ec8e4a8307a148ce3..e4c5a7b6f673cfd266891e5c417bf5a6e612c497 100644 (file)
@@ -405,12 +405,15 @@ public:
 
 class TestServer : public NetChannel
 {
+    simgear::NetChannelPoller _poller;
 public:   
     TestServer()
     {
         open();
         bind(NULL, 2000); // localhost, any port
         listen(5);
+        
+        _poller.addChannel(this);
     }
     
     virtual ~TestServer()
@@ -426,14 +429,25 @@ public:
         //cout << "did accept from " << addr.getHost() << ":" << addr.getPort() << endl;
         TestServerChannel* chan = new TestServerChannel();
         chan->setHandle(handle);
+        
+        _poller.addChannel(chan);
+    }
+    
+    void poll()
+    {
+        _poller.poll();
     }
 };
 
+TestServer testServer;
+
 void waitForComplete(HTTP::Client* cl, TestRequest* tr)
 {
     SGTimeStamp start(SGTimeStamp::now());
     while (start.elapsedMSec() <  1000) {
         cl->update();
+        testServer.poll();
+        
         if (tr->complete) {
             return;
         }
@@ -448,6 +462,8 @@ void waitForFailed(HTTP::Client* cl, TestRequest* tr)
     SGTimeStamp start(SGTimeStamp::now());
     while (start.elapsedMSec() <  1000) {
         cl->update();
+        testServer.poll();
+        
         if (tr->failed) {
             return;
         }
@@ -459,7 +475,6 @@ void waitForFailed(HTTP::Client* cl, TestRequest* tr)
 
 int main(int argc, char* argv[])
 {
-    TestServer s;
     
     HTTP::Client cl;