Changeset 72:d0276f64c6d0 in finroc_plugins_network_transport
- Timestamp:
- 15.04.2021 08:39:40 (2 years ago)
- Branch:
- 17.03
- Children:
- 73:217a300eb4ec, 74:cdad292a2caa
- Phase:
- public
- Location:
- generic_protocol
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
generic_protocol/tNetworkPortInfo.cpp
r26 r72 66 66 // Const values 67 67 //---------------------------------------------------------------------- 68 __thread tNetworkPortInfo* tNetworkPortInfo::current_publishing_network_port = nullptr;69 68 70 69 //---------------------------------------------------------------------- … … 127 126 } 128 127 128 bool tNetworkPortInfo::tNetworkPortPublishingContext::Is(const std::type_info& info) 129 { 130 return info == typeid(tNetworkPortInfo::tNetworkPortPublishingContext); 131 } 132 129 133 //---------------------------------------------------------------------- 130 134 // End of namespace declaration -
generic_protocol/tNetworkPortInfo.h
r52 r72 163 163 void OnPortChange(data_ports::tPortDataPointer<const rrlib::rtti::tGenericObject>& value, data_ports::tChangeContext& change_context) 164 164 { 165 auto root_context = data_ports::common::tScopedContext::RootContext(); 166 165 167 //FINROC_LOG_PRINT(DEBUG, "Port Changed ", port.GetWrapped()->GetQualifiedName(), " ", rrlib::serialization::Serialize(*value)); 166 if (strategy > 0 && (!( current_publishing_network_port && current_publishing_network_port->connection_handle == connection_handle && (¤t_publishing_network_port->remote_runtime == &remote_runtime))))168 if (strategy > 0 && (!(root_context && typeid(*root_context) == typeid(tNetworkPortPublishingContext) && static_cast<tNetworkPortPublishingContext*>(root_context)->current_publishing_network_port.connection_handle == connection_handle && (&static_cast<tNetworkPortPublishingContext*>(root_context)->current_publishing_network_port.remote_runtime == &remote_runtime)))) 167 169 { 168 170 remote_runtime.GetLocalRuntimeInfo().OnPortChange(value, this, change_context); … … 322 324 std::unique_ptr<tNetworkPortInfoClient> client_info; 323 325 324 /*! Network port that currently publishes data using the current thread (null if current thread does not publish data from the net) */ 325 static __thread tNetworkPortInfo* current_publishing_network_port; 326 class tNetworkPortPublishingContext : public data_ports::common::tScopedContext 327 { 328 public: 329 330 tNetworkPortPublishingContext(tNetworkPortInfo& current_publishing_network_port) : 331 current_publishing_network_port(current_publishing_network_port) 332 { 333 assert(tScopedContext::RootContext() == this); 334 } 335 336 /*! Network port that currently publishes data using the current thread (null if current thread does not publish data from the net) */ 337 tNetworkPortInfo& current_publishing_network_port; 338 339 virtual bool Is(const std::type_info& info) override; 340 }; 326 341 327 342 -
generic_protocol/tRemoteRuntime.cpp
r70 r72 302 302 if (port.first && port.first->IsReady() && data_ports::IsDataFlowType(port.first->GetDataType())) 303 303 { 304 tNetworkPortInfo:: current_publishing_network_port = port.second;304 tNetworkPortInfo::tNetworkPortPublishingContext scoped_context(*port.second); 305 305 data_ports::tGenericPort generic_port = data_ports::tGenericPort::Wrap(*port.first); 306 306 … … 347 347 while (another_value); 348 348 349 tNetworkPortInfo::current_publishing_network_port = nullptr;350 349 message.FinishDeserialize(stream); 351 350 connection.received_data_after_last_connect = true;
Note: See TracChangeset
for help on using the changeset viewer.