| 76 | } |
| 77 | |
| 78 | void |
| 79 | SyncServer_i::register_me (::Sync::Role role, ::Sync::Client_ptr callback, |
| 80 | ::Sync::Id_out id) |
| 81 | { |
| 82 | //ACE_DEBUG ((LM_DEBUG, "(%P|%t) SyncServer_i::register_me\n")); |
| 83 | try{ |
| 84 | // Hack to offset connection setup cost later. |
| 85 | callback->_non_existent (); |
| 86 | } |
| 87 | catch (const CORBA::Exception& ex) |
| 88 | { |
| 89 | ACE_ERROR ((LM_ERROR, "SyncServer> Callback connection establishment failed: %C\n" |
| 90 | , ex._info().c_str())); |
| 91 | // should we continue. For now yes, else SynchServer will may become unresponsive. |
| 92 | } |
| 93 | |
| 94 | Sync::Client_ptr cl = Sync::Client::_duplicate (callback); |
| 95 | const Sync::Id count = static_cast<Sync::Id>(count_); |
| 96 | ClientInfo cl_info(count, cl, role, -1); |
| 97 | |
| 98 | switch (role) |
| 99 | { |
| 100 | case Sync::Sub: |
| 101 | if (subs_.size() >= sub_count_) { |
| 102 | ACE_DEBUG ((LM_DEBUG, "SyncServer> Subscriber list is full. " |
| 103 | "Rejecting new subscriber.\n")); |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | if (subs_.insert(subs_.end(), ClientInfos::value_type(count, cl_info)) |
| 108 | != subs_.end()) { |
| 109 | id = count; |
| 110 | } |
| 111 | break; |
| 112 | case Sync::Pub: |
| 113 | if (pubs_.size() >= pub_count_) { |
| 114 | ACE_DEBUG ((LM_DEBUG, "SyncServer> Publisher list is full. " |
| 115 | "Rejecting new publisher.\n")); |
| 116 | return; |
| 117 | } |
| 118 | |
| 119 | if (pubs_.insert(pubs_.end(), ClientInfos::value_type(count, cl_info)) |
| 120 | != pubs_.end()) { |
| 121 | id = count; |
| 122 | } |
| 123 | break; |
| 124 | } |
| 125 | |
| 126 | // increment the id count. |
| 127 | count_++; |
| 128 | |
| 129 | //ACE_DEBUG ((LM_DEBUG, "(%P|%t) SyncServer_i::register_me\n" |
| 130 | //"Pubs: %d, Subs: %d\n", pubs_.size(), subs_.size())); |
| 131 | } |
| 132 | |
| 133 | void |
| 134 | SyncServer_i::unregister (::Sync::Id id) |
no test coverage detected