* Sends message to the Primary Instance. * @param message The message to send. * @param timeout the maximum timeout in milliseconds for blocking functions. * @return true if the message was sent successfuly, false otherwise. */
| 238 | * @return true if the message was sent successfuly, false otherwise. |
| 239 | */ |
| 240 | bool SingleApplication::sendMessage( const QByteArray &message, int timeout ) |
| 241 | { |
| 242 | Q_D( SingleApplication ); |
| 243 | |
| 244 | // Nobody to connect to |
| 245 | if( isPrimary() ) return false; |
| 246 | |
| 247 | // Make sure the socket is connected |
| 248 | if( ! d->connectToPrimary( timeout, SingleApplicationPrivate::Reconnect ) ) |
| 249 | return false; |
| 250 | |
| 251 | return d->writeConfirmedMessage( timeout, message ); |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Cleans up the shared memory block and exits with a failure. |
nothing calls this directly
no test coverage detected