| 99 | } |
| 100 | |
| 101 | void FileLinkApp::joinServer(QString server) |
| 102 | { |
| 103 | blockSize = 0; |
| 104 | |
| 105 | in.setDevice(&socket); |
| 106 | |
| 107 | connect(&socket, &QLocalSocket::connected, this, [&]() { qDebug() << "connected to server"; }); |
| 108 | |
| 109 | connect(&socket, &QLocalSocket::readyRead, this, &FileLinkApp::readPathPairs); |
| 110 | |
| 111 | connect(&socket, &QLocalSocket::errorOccurred, this, [&](QLocalSocket::LocalSocketError socketError) { |
| 112 | m_status = Failed; |
| 113 | switch (socketError) { |
| 114 | case QLocalSocket::ServerNotFoundError: |
| 115 | qDebug() |
| 116 | << ("The host was not found. Please make sure " |
| 117 | "that the server is running and that the " |
| 118 | "server name is correct."); |
| 119 | break; |
| 120 | case QLocalSocket::ConnectionRefusedError: |
| 121 | qDebug() |
| 122 | << ("The connection was refused by the peer. " |
| 123 | "Make sure the server is running, " |
| 124 | "and check that the server name " |
| 125 | "is correct."); |
| 126 | break; |
| 127 | case QLocalSocket::PeerClosedError: |
| 128 | qDebug() << ("The connection was closed by the peer. "); |
| 129 | break; |
| 130 | default: |
| 131 | qDebug() << "The following error occurred: " << socket.errorString(); |
| 132 | } |
| 133 | }); |
| 134 | |
| 135 | connect(&socket, &QLocalSocket::disconnected, this, [&]() { |
| 136 | qDebug() << "disconnected from server, should exit"; |
| 137 | m_status = Succeeded; |
| 138 | exit(); |
| 139 | }); |
| 140 | |
| 141 | socket.connectToServer(server); |
| 142 | } |
| 143 | |
| 144 | void FileLinkApp::runLink() |
| 145 | { |
nothing calls this directly
no test coverage detected