Changeset 4952 in ntrip


Ignore:
Timestamp:
Feb 23, 2013, 5:24:52 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GnssCenter/thrift/test2/server.cpp

    r4951 r4952  
    1919using namespace apache::thrift::concurrency;
    2020
    21 class myService : virtual public myServiceIf {
    22  public:
    23   myService() {}
    24   void answer(const std::string& question) {
    25     // implemented on the client-side only
    26   }
    27 };
    28 
    2921class t_connection {
    3022 public:
    31   shared_ptr<myService>       _service;
    3223  shared_ptr<myServiceClient> _client;
    3324  shared_ptr<TProcessor>      _processor;
     
    4435  shared_ptr<TProcessor>   getProcessor(const TConnectionInfo& info) {
    4536    shared_ptr<myServiceClient> client(new myServiceClient(info.output));
    46     shared_ptr<myService>       service(new myService());
    47     shared_ptr<TProcessor>      processor(new myServiceProcessor(service));
    48     cout << "connection " << endl;
     37    shared_ptr<TProcessor>      processor(new myServiceProcessor(client));
     38
     39    cout << "new connection " << endl;
    4940
    5041    CONNECTION.reset(new t_connection);   
    51     CONNECTION->_service     = service;
    5242    CONNECTION->_client      = client;
    5343    CONNECTION->_processor   = processor;
     
    8676  thread->start();
    8777
    88   cout << "server thread started" << endl;
    89 
    90   while (true) {
    91     cout << "sleep ..." << endl;
    92     if (CONNECTION) {
    93       cout << "CONNECTION " << endl;
    94       CONNECTION->_client->answer("How are you?");
     78  try {
     79    while (true) {
     80      if (CONNECTION) {
     81        CONNECTION->_client->answer("How are you?");
     82      }
     83      sleep(1);
    9584    }
    96     sleep(1);
     85  } catch (TException& exc) {
     86    cout << "Exception: " << exc.what() << endl;
    9787  }
    9888
Note: See TracChangeset for help on using the changeset viewer.