Skip to content

Commit

Permalink
Merge pull request #499 from vlantonov/APPLINK-23563
Browse files Browse the repository at this point in the history
hotfix/SDL does not release memory after app unregistering
  • Loading branch information
AGaliuzov committed Apr 28, 2016
2 parents bb5d894 + d0c939e commit d7c4c0c
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,15 @@ class TransportAdapter {
*/
virtual Error StopClientListening() = 0;

/**
* @brief Remove marked as FINALISING connection from accounting.
*
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
*/
virtual void RemoveFinalizedConnection(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) = 0;

/**
* @brief Disconnect from specified session.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class TransportAdapterController {
const ConnectError& error) = 0;

/**
* @brief Make state of specified connection - FINILIZING.
* @brief Make state of specified connection - FINALISING.
*
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TransportAdapterImpl : public TransportAdapter,
* @return true if initialized.
* @return false if not initialized.
*/
virtual bool IsInitialised() const;
bool IsInitialised() const OVERRIDE;

public:
/**
Expand All @@ -103,20 +103,20 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Error information about possible reason of failure.
**/
virtual TransportAdapter::Error Init();
TransportAdapter::Error Init() OVERRIDE;

/**
* @brief Stops device adapter
* Called from transport manager to stop device adapter
*/
virtual void Terminate();
void Terminate() OVERRIDE;

/**
* @brief Add listener to the container(list) of device adapter listeners.
*
* @param listener Pointer to the device adapter listener.
*/
virtual void AddListener(TransportAdapterListener* listener);
void AddListener(TransportAdapterListener* listener) OVERRIDE;

/**
* @brief Start scanning for new devices.
Expand All @@ -125,7 +125,7 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Error information about possible reason of search devices failure.
**/
virtual TransportAdapter::Error SearchDevices();
TransportAdapter::Error SearchDevices() OVERRIDE;

/**
* @brief Connect to the specified application discovered on device.
Expand All @@ -135,15 +135,16 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Error information about possible reason of failure.
**/
virtual TransportAdapter::Error Connect(const DeviceUID& device_handle,
const ApplicationHandle& app_handle);
TransportAdapter::Error Connect(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) OVERRIDE;

/**
* @brief Connect to all applications discovered on device
* @param device_handle Handle of device
* @return Error information about connecting applications on device
*/
virtual TransportAdapter::Error ConnectDevice(const DeviceUID& device_handle);
TransportAdapter::Error ConnectDevice(const DeviceUID& device_handle)
OVERRIDE;

/**
* @brief Disconnect from specified session.
Expand All @@ -153,8 +154,9 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Error information about possible reason of disconnecting failure.
**/
virtual TransportAdapter::Error Disconnect(
const DeviceUID& device_handle, const ApplicationHandle& app_handle);
TransportAdapter::Error Disconnect(const DeviceUID& device_handle,
const ApplicationHandle& app_handle)
OVERRIDE;

/**
* @brief Disconnect from all sessions on specified device.
Expand All @@ -164,8 +166,8 @@ class TransportAdapterImpl : public TransportAdapter,
* @return Error information about possible reason of disconnecting from
*specified device failure.
**/
virtual TransportAdapter::Error DisconnectDevice(
const DeviceUID& device_handle);
TransportAdapter::Error DisconnectDevice(const DeviceUID& device_handle)
OVERRIDE;

/**
* @brief Send frame of data.
Expand All @@ -176,52 +178,52 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Error information about possible reason of sending data failure
**/
virtual TransportAdapter::Error SendData(
const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const ::protocol_handler::RawMessagePtr data);
TransportAdapter::Error SendData(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const ::protocol_handler::RawMessagePtr data)
OVERRIDE;

/**
* @brief Start client listener.
*
* @return Error information about possible reason of failure.
*/
virtual TransportAdapter::Error StartClientListening();
TransportAdapter::Error StartClientListening() OVERRIDE;

/**
* @brief Stop client listener.
*
* @return Error information about possible reason of failure.
*/
virtual TransportAdapter::Error StopClientListening();
TransportAdapter::Error StopClientListening() OVERRIDE;

/**
* @brief Notify that device scanner is available.
*
* @return True - available, false - not available.
*/
virtual bool IsSearchDevicesSupported() const;
bool IsSearchDevicesSupported() const OVERRIDE;

/**
* @brief Notify that server connection factory is available.
*
* @return True - available, false - not available.
*/
virtual bool IsServerOriginatedConnectSupported() const;
bool IsServerOriginatedConnectSupported() const OVERRIDE;

/**
* @brief Notify that listener of client connection is available.
*
* @return True - available, false - not available.
*/
virtual bool IsClientOriginatedConnectSupported() const;
bool IsClientOriginatedConnectSupported() const OVERRIDE;

/**
* @brief Create container(vector) of device unique identifiers.
*
* @return Container(vector) of device unique identifiers.
*/
virtual DeviceList GetDeviceList() const;
DeviceList GetDeviceList() const OVERRIDE;

/**
* @brief Get container(vector) of application unique identifiers that
Expand All @@ -231,8 +233,8 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Container(vector) that holds application unique identifiers.
*/
virtual ApplicationList GetApplicationList(
const DeviceUID& device_handle) const;
ApplicationList GetApplicationList(const DeviceUID& device_handle) const
OVERRIDE;

/**
* @brief Find device in the internal container(map).
Expand All @@ -241,26 +243,26 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Smart pointer to device.
*/
virtual DeviceSptr FindDevice(const DeviceUID& device_handle) const;
DeviceSptr FindDevice(const DeviceUID& device_handle) const OVERRIDE;

/**
* @brief Search for device in container of devices, if it is not there - adds
*it.
*
* @param devices Container(vector) of smart pointers to devices.
*/
virtual void SearchDeviceDone(const DeviceVector& devices);
void SearchDeviceDone(const DeviceVector& devices) OVERRIDE;

virtual void ApplicationListUpdated(const DeviceUID& device_handle);
void ApplicationListUpdated(const DeviceUID& device_handle) OVERRIDE;

virtual void FindNewApplicationsRequest();
void FindNewApplicationsRequest() OVERRIDE;

/**
* @brief Launch OnSearchDeviceFailed event in device adapter listener.
*
* @param error Error class that contains details of this error situation.
*/
virtual void SearchDeviceFailed(const SearchDeviceError& error);
void SearchDeviceFailed(const SearchDeviceError& error) OVERRIDE;

/**
* @brief Add device to the container(map), if container doesn't hold it yet.
Expand All @@ -269,7 +271,7 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return Smart pointer to the device.
*/
virtual DeviceSptr AddDevice(DeviceSptr device);
DeviceSptr AddDevice(DeviceSptr device) OVERRIDE;

/**
* @brief Create connection and fill its parameters.
Expand All @@ -278,30 +280,30 @@ class TransportAdapterImpl : public TransportAdapter,
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
*/
virtual void ConnectionCreated(ConnectionSPtr connection,
const DeviceUID& device_handle,
const ApplicationHandle& app_handle);
void ConnectionCreated(ConnectionSPtr connection,
const DeviceUID& device_handle,
const ApplicationHandle& app_handle) OVERRIDE;

/**
* @brief Set state of specified connection - FINILIZING.
* @brief Set state of specified connection - FINALISING.
*
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
*/
virtual void ConnectionFinished(const DeviceUID& device_handle,
const ApplicationHandle& app_handle);
void ConnectionFinished(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) OVERRIDE;

/**
* @brief Set specified connection state to FINILIZING and launch
* @brief Set specified connection state to FINALISING and launch
*OnUnexpectedDisconnect event in the device adapter listener.
*
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
* @param error Error class that contains details of this error situation.
*/
virtual void ConnectionAborted(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const CommunicationError& error);
void ConnectionAborted(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const CommunicationError& error) OVERRIDE;

/**
* @brief Set state of specified connection - ESTABLISHED and launch
Expand All @@ -310,8 +312,8 @@ class TransportAdapterImpl : public TransportAdapter,
* @param devcie_handle Device unique identifier.
* @param app_handle Handle of application.
*/
virtual void ConnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle);
void ConnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) OVERRIDE;

/**
* @brief Delete connection from the container of connections and launch
Expand All @@ -320,17 +322,26 @@ class TransportAdapterImpl : public TransportAdapter,
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
*/
virtual void ConnectFailed(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const ConnectError& error);
void ConnectFailed(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const ConnectError& error) OVERRIDE;

/**
* @brief Remove marked as FINALISING connection from accounting.
*
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
*/
void RemoveFinalizedConnection(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) OVERRIDE;

/**
* @brief Remove specified device and all its connections
* @param device_handle Device unique identifier.
* @param error Error class that contains details of this error situation.
*/
virtual void DeviceDisconnected(const DeviceUID& device_handle,
const DisconnectDeviceError& error);
void DeviceDisconnected(const DeviceUID& device_handle,
const DisconnectDeviceError& error) OVERRIDE;

/**
* @brief Delete specified connection from the container(map) of connections
Expand All @@ -339,8 +350,8 @@ class TransportAdapterImpl : public TransportAdapter,
* @param device_handle Device unique identifier.
* @param app_handle Handle of application.
*/
virtual void DisconnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle);
void DisconnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) OVERRIDE;

/**
* @brief Launch OnDataReceiveDone event in the device adapter listener.
Expand All @@ -349,9 +360,9 @@ class TransportAdapterImpl : public TransportAdapter,
* @param app_handle Handle of application.
* @param message Smart pointer to the raw message.
*/
virtual void DataReceiveDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message);
void DataReceiveDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message) OVERRIDE;

/**
* @brief Launch OnDataReceiveFailed event in the device adapter listener.
Expand All @@ -360,9 +371,9 @@ class TransportAdapterImpl : public TransportAdapter,
* @param app_handle Handle of application.
* @param error Class that contains details of this error situation.
*/
virtual void DataReceiveFailed(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const DataReceiveError& error);
void DataReceiveFailed(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
const DataReceiveError& error) OVERRIDE;

/**
* @brief Launch OnDataSendDone event in the device adapter listener.
Expand All @@ -371,9 +382,9 @@ class TransportAdapterImpl : public TransportAdapter,
* @param app_handle Handle of application.
* @param message Smart pointer to raw message.
*/
virtual void DataSendDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message);
void DataSendDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message) OVERRIDE;

/**
* @brief Launch OnDataSendFailed event in the device adapter listener.
Expand All @@ -383,10 +394,10 @@ class TransportAdapterImpl : public TransportAdapter,
* @param message Smart pointer to raw message.
* @param error Class that contains details of this error situation.
*/
virtual void DataSendFailed(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message,
const DataSendError& error);
void DataSendFailed(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message,
const DataSendError& error) OVERRIDE;

/**
* @brief Return name of device.
Expand All @@ -395,13 +406,13 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return String with name.
*/
virtual std::string DeviceName(const DeviceUID& device_id) const;
std::string DeviceName(const DeviceUID& device_id) const OVERRIDE;

/**
* @brief Allows to obtain connection type used by device.
* @return connection type.
*/
virtual std::string GetConnectionType() const;
std::string GetConnectionType() const OVERRIDE;

#ifdef TELEMETRY_MONITOR
/**
Expand All @@ -416,7 +427,7 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @param return pointer to Time metric observer
*/
virtual TMTelemetryObserver* GetTelemetryObserver();
TMTelemetryObserver* GetTelemetryObserver() OVERRIDE;
#endif // TELEMETRY_MONITOR

protected:
Expand Down
Loading

0 comments on commit d7c4c0c

Please # to comment.