| 671 | } |
| 672 | |
| 673 | void CloseIoConnection(CipConnectionObject *connection_object) { |
| 674 | |
| 675 | CheckIoConnectionEvent(connection_object->consumed_path.instance_id, |
| 676 | connection_object->produced_path.instance_id, |
| 677 | kIoConnectionEventClosed); |
| 678 | ConnectionObjectSetState(connection_object, |
| 679 | kConnectionObjectStateNonExistent); |
| 680 | |
| 681 | if ( kConnectionObjectInstanceTypeIOExclusiveOwner == |
| 682 | ConnectionObjectGetInstanceType(connection_object) |
| 683 | || kConnectionObjectInstanceTypeIOInputOnly == |
| 684 | ConnectionObjectGetInstanceType(connection_object) ) { |
| 685 | if ( ( kConnectionObjectConnectionTypeMulticast |
| 686 | == ConnectionObjectGetTToOConnectionType(connection_object) ) |
| 687 | && (kEipInvalidSocket |
| 688 | != connection_object->socket[kUdpCommuncationDirectionProducing]) ) |
| 689 | { |
| 690 | OPENER_TRACE_INFO( |
| 691 | "Exclusive Owner or Input Only connection closed - Instance type :%d\n", |
| 692 | ConnectionObjectGetInstanceType(connection_object) ); |
| 693 | CipConnectionObject *next_non_control_master_connection = |
| 694 | GetNextNonControlMasterConnection( |
| 695 | connection_object->produced_path.instance_id); |
| 696 | if (NULL != next_non_control_master_connection) { |
| 697 | |
| 698 | OPENER_TRACE_INFO("Transfer socket ownership\n"); |
| 699 | next_non_control_master_connection->socket[ |
| 700 | kUdpCommuncationDirectionProducing] = |
| 701 | connection_object->socket[kUdpCommuncationDirectionProducing]; |
| 702 | |
| 703 | connection_object->socket[kUdpCommuncationDirectionProducing] = |
| 704 | kEipInvalidSocket; |
| 705 | /* End */ |
| 706 | |
| 707 | memcpy( &(next_non_control_master_connection->remote_address), |
| 708 | &(connection_object->remote_address), |
| 709 | sizeof(next_non_control_master_connection->remote_address) ); |
| 710 | next_non_control_master_connection->eip_level_sequence_count_producing |
| 711 | = |
| 712 | connection_object->eip_level_sequence_count_producing; |
| 713 | next_non_control_master_connection->sequence_count_producing = |
| 714 | connection_object->sequence_count_producing; |
| 715 | next_non_control_master_connection->transmission_trigger_timer = |
| 716 | connection_object->transmission_trigger_timer; |
| 717 | } else { /* this was the last master connection close all listen only connections listening on the port */ |
| 718 | CloseAllConnectionsForInputWithSameType( |
| 719 | connection_object->produced_path.instance_id, |
| 720 | kConnectionObjectInstanceTypeIOListenOnly); |
| 721 | } |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | CloseCommunicationChannelsAndRemoveFromActiveConnectionsList( |
| 726 | connection_object); |
| 727 | } |
| 728 | |
| 729 | void HandleIoConnectionTimeOut(CipConnectionObject *connection_object) { |
| 730 | CheckIoConnectionEvent(connection_object->produced_path.instance_id, |
nothing calls this directly
no test coverage detected