summaryrefslogtreecommitdiff
path: root/src/libs/ssh/sshconnectionmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Ssh: Rename SshConnectionParameters into SshParametersJarek Kobus2022-05-231-226/+0
| | | | | | | | | | Move it to its own header. Get rid of SshConnection and SshConnectionManager, as they are not used anymore. Change-Id: I52fe20d7816ea57e7a7158ab2ae9565d50a76e21 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Ssh: fix crash on freed memory accessAlexander Drozdov2022-01-281-0/+1
| | | | | | | | | | | At the cleanup() method we must remove connection from the m_connection list to avoid access to the freed memory from the removeInactiveConnections() that caused Qt Creator crash. Change-Id: I8195f05e903819e3e3b48b2f72fd71047c5a1636 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Refactor SshConnectionManager internalsJarek Kobus2022-01-121-95/+90
| | | | | | | | | It makes it easier to manage just one hash of connections instead of 3 lists. Change-Id: Id6a3661d8dfdb0bd269e35ece36410bd2477e5c6 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Introduce Utils::SingletonJarek Kobus2021-09-281-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce Utils::Singleton class and Utils::SingletonWithOptionalDependencies class template that helps implementing singletons that depend on other singletons. It's guaranteed that whenever singleton B depends on singleton A, than A is always created before B is being created, and that the order of destruction is always opposite to the order of creation. Dependencies of singleton are listed as template arguments for SingletonWithOptionalDependencies class template. The first argument of SingletonWithOptionalDependencies class template is always a singleton class itself. Prepare a common interface for all singleton subclasses: SingletonSubClass *SingletonWithOptionalDependencies::instance(); Make instantiating singletons and its dependencies thread-safe. Create singletons on demand (only if some code needs them). It's not needed anymore to explicitly instantiate all required singletons in tests. Make it possible (and thread-safe) to instantiate ProcessReaper and LauncherInterface singletons in non-main threads. Make the following dependencies between existing singletons: SshConnectionManager depends on: -> LauncherInterface depends on: -> ProcessReaper Change-Id: Iefaacab561c2b3dcf07e7fafbb87339ea6a15278 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Control the lifetime of SshProcessManagerJarek Kobus2021-09-101-19/+29
| | | | | | | | | | | | | | | | | | | | Make it possible to control when the SshProcessManager is being constructed / destructed. Expose public constructor. Since different singletons depend on each other, we need to control the order of creation and destruction of them. The order of creation is like that: 1. QCoreApplication 2. ProcessReaper 3. ProcessLauncher 4. SshConnectionManager The order of destruction must be opposite to the above. Change-Id: Ice07eb751cd61c03cb461816fa1b74ab040a53de Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Remove code that tried to handle SshConnections in non-main threadsJarek Kobus2021-09-101-78/+34
| | | | | | | | | | | | | | | | | The SshConnection wasn't used in non-main thread anyway and the implementation couldn't work properly in multiple threads. Fix "acquire" typo in variable and class names. Make SshConnectionManager a child of application object, so that it will be deleted together with it. Replace forever with ranged for loop. Change-Id: I3c3592eb5ce20b463d5a656f94cadaccccf652dc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
* SSH: Do not manage unshared connectionsChristian Kandeler2021-01-291-3/+6
| | | | | | | | Unshared connections are not re-usable, so our whole book-keeping procedure is not needed for them. Change-Id: I1b6ca3d1658d139b6687425cf32f821548dddade Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Use typed syntax in calls to QMetaObject::invokeMethodJarek Kobus2020-11-161-5/+5
| | | | | | | | | We do it wherever possible. Some places can't be fixed since they still rely on dynamic introspection (mainly QQuickItem cases). Change-Id: Ia00b4a04d8b995c9a43b7bf2dbe76a60364bb8ca Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Some clang-tidy -use-modernize-nullptrhjk2019-08-011-5/+5
| | | | | Change-Id: I1bed5e85a5b7948d08502a72a10f80baa075c204 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* SSH: Use OpenSSH toolsChristian Kandeler2018-12-131-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of our own SSH library. Advantages: - Full compatibility with OpenSSH behavior guaranteed. - Minimal maintenance effort. - Less code to build. - Big chunk of 3rd party sources can be removed from our repository. One the downside, Windows users now need to install OpenSSH for RemoteLinux support. Hoewever, people doing embedded development probably have it installed anyway. [ChangeLog] Switched SSH backend to OpenSSH Fixes: QTCREATORBUG-15744 Fixes: QTCREATORBUG-15807 Fixes: QTCREATORBUG-19306 Fixes: QTCREATORBUG-20210 Change-Id: Ifcfefdd39401e45ba1f4aca35d2c5bf7046c7aab Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* SSH: Use Qt5-style connectsOrgad Shaneh2016-06-151-1/+0
| | | | | | | The heavy lifting was done by clazy. Change-Id: I04261849c92c54990f9f142fe541d984c5fb21d3 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update remaining files in src Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'Eike Ziller2015-02-121-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/utils/tooltip/tipcontents.cpp src/libs/utils/tooltip/tipcontents.h src/plugins/android/androiddeployqtstep.cpp src/plugins/baremetal/baremetalconstants.h src/plugins/baremetal/baremetaldevice.cpp src/plugins/baremetal/baremetaldevice.h src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp src/plugins/baremetal/baremetaldeviceconfigurationwidget.h src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h src/plugins/baremetal/baremetalplugin.cpp src/plugins/baremetal/baremetalplugin.h src/plugins/baremetal/baremetalruncontrolfactory.cpp src/plugins/baremetal/baremetalruncontrolfactory.h src/plugins/cppeditor/cppcodemodelinspectordialog.cpp src/plugins/cppeditor/cppdoxygen_test.cpp src/plugins/cppeditor/cppdoxygen_test.h src/plugins/debugger/breakpointmarker.cpp src/plugins/debugger/debuggeritemmodel.cpp src/plugins/debugger/debuggeritemmodel.h src/plugins/debugger/loadcoredialog.cpp src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp src/plugins/projectexplorer/addnewmodel.cpp src/plugins/projectexplorer/addnewmodel.h src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp src/plugins/qmlprofiler/abstracttimelinemodel.cpp src/plugins/qmlprofiler/abstracttimelinemodel.h src/plugins/qmlprofiler/notesmodel.cpp src/plugins/qmlprofiler/qml/CategoryLabel.qml src/plugins/qmlprofiler/qml/MainView.qml src/plugins/qmlprofiler/qml/Overview.js src/plugins/qmlprofiler/qml/Overview.qml src/plugins/qmlprofiler/qml/TimeDisplay.qml src/plugins/qmlprofiler/qml/TimeMarks.qml src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp src/plugins/qmlprofiler/sortedtimelinemodel.cpp src/plugins/qmlprofiler/sortedtimelinemodel.h src/plugins/qmlprofiler/timelinemodelaggregator.cpp src/plugins/qmlprofiler/timelinemodelaggregator.h src/plugins/qmlprofiler/timelinerenderer.cpp src/plugins/qmlprofiler/timelinerenderer.h src/plugins/qmlprojectmanager/QmlProjectManager.json.in src/plugins/texteditor/findinfiles.cpp src/plugins/vcsbase/vcsconfigurationpage.cpp src/shared/qbs src/shared/scriptwrapper/interface_wrap_helpers.h src/shared/scriptwrapper/wrap_helpers.h tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp tests/system/suite_debugger/tst_debug_empty_main/test.py tests/system/suite_debugger/tst_qml_js_console/test.py tests/system/suite_debugger/tst_qml_locals/test.py Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
| * Update LicenseEike Ziller2015-01-161-6/+6
| | | | | | | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* | Port to new connect apiMontel Laurent2015-02-041-1/+2
| | | | | | | | | | | | Change-Id: I84834f37dd15108ed8c5fbf5353bcabc4e564f70 Reviewed-by: hjk <hjk@theqtcompany.com> Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* | SshConnectionManager: s/break/continueChristian Kandeler2014-12-191-2/+2
| | | | | | | | | | | | | | Probably just a thinko in the original code. Change-Id: Ie089737a3501c5aede9a2234c10e4f1c1611d952 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* | SSH: Close unused cached connections after a period of inactivity.Christian Kandeler2014-12-181-13/+47
|/ | | | | | | | | | | We keep connections open to avoid re-doing the authentication procedure when the user runs or deploys a remote app repeatedly. However, the connections should not be around indefinitely; we therefore now close them after about five minutes of inactivity. Change-Id: Ie677eb133b618d34c08528da2f2bc221472316b3 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
* License updateEike Ziller2014-10-091-7/+8
| | | | | Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* Incremented year in copyright infoRobert Loehning2014-01-081-1/+1
| | | | | | Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Clean up SshConnectionManager interfacehjk2013-09-111-30/+16
| | | | | Change-Id: Id1541f83f431171dbdd94d5dd48f93e1c2cdf6fb Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* SSH: Remove questionable warning in connection manager.Christian Kandeler2013-08-081-4/+1
| | | | | | | | | | | | If there are still open channels in a connection being released, that is not necessarily a mistake: The channels could already be in the closing state, and it would be unreasonable for us to expect API clients to always wait for confirmation before releasing the connection, as this can complicate code quite a bit, turning a synchronous operation into an asynchronous one. Change-Id: If8c604c9ee1294728e7947c8d5c8130d6e704b49 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
* Incremented year in copyright infov2.6.2Robert Loehning2013-01-291-1/+1
| | | | | Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Adjust license headershjk2012-10-051-21/+20
| | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* SSH: Take more care when closing channels.Christian Kandeler2012-08-201-0/+2
| | | | | | | | We can't just pretend a channel is already gone after we request it to close; it's only closed when the server has sent the acknowledgement. Change-Id: Ib6e8b9bf77635995259885af13755f5fc0e825a9 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
* Contact -> qt-project.orgEike Ziller2012-07-191-3/+1
| | | | | Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* SSH: Close channels before re-using a connection.Christian Kandeler2012-06-281-2/+7
| | | | | | | | | | | | Otherwise a new client acquiring the connection could be affected by things happening in channels that were not opened by that client, which would certainly be unexpected. In particular, if the new owner of the connection runs in a different thread than the old one, crashes could occur since the connection assumes its channels run in the same thread. Change-Id: I4fdf2b5a3751ed506631d6878e94342da033c31c Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
* SSH: Fix some potential crashes.Christian Kandeler2012-06-061-1/+1
| | | | | | Change-Id: I102e35c3dcd3725f357c91d9f0a77ab28d881b0d Reviewed-by: Oliver Wolff <oliver.wolff@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
* SSH: Use plain pointers to SshConnection objects.Christian Kandeler2012-05-291-43/+69
| | | | | | | | | | It used to be shared pointers so that existing connection objects could easily be passed around in order not to open a new connection to the same server. Since the introduction of the SshConnectionManager, this is no longer necessary. Change-Id: I13fd3eceaf35d562e6260e9969abbffb01edd6b5 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
* Move SSH support into a dedicated library.Christian Kandeler2012-05-221-0/+227
It does not belong into libUtils, which is a collection of small unrelated utility classes. Task-number: QTCREATORBUG-7218 Change-Id: Id92b9f28678afec93e6f07166adfde6550f38072 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>