Changeset 3b1426dce275c146696e284ef7e2a97e29f16847
- Timestamp:
- 02/09/12 12:33:20 (3 months ago)
- Author:
- David C. Lonie <loniedavid@…>
- Parents:
- cdbef0057e4f15619cdc19e6e3fe32b490bdf055, f47c5505c30559e53309acf51db69912dec55033
- Children:
- 5a9bb82c30cb2d37f28bcd39eb822b9ecdc2039d
- git-committer:
- David C. Lonie <loniedavid@…> (02/09/12 12:33:20)
- Message:
-
Merge branch 'MAINT_use_sys_libssh'
- Location:
- src
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r2c6c6bd7
|
rf47c5505
|
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | | // Set a three timeout, check every 50 ms for new data. |
| | 82 | // Set a three second timeout, check every 50 ms for new data. |
| 83 | 83 | int bytesAvail; |
| 84 | 84 | int timeout = 3000; |
| … |
… |
|
| 410 | 410 | // Read output |
| 411 | 411 | char buffer[SSH_BUFFER_SIZE]; |
| 412 | | int len; |
| 413 | | while ((len = channel_read(channel, buffer, sizeof(buffer), 0)) > 0) { |
| 414 | | ossout.write(buffer,len); |
| | 412 | int bytesAvail; |
| | 413 | // Wait three seconds for output |
| | 414 | int timeout = 3000; |
| | 415 | do { |
| | 416 | bytesAvail = channel_poll(channel, 0); |
| | 417 | if (bytesAvail == 0) { |
| | 418 | GS_MSLEEP(50); |
| | 419 | timeout -= 50; |
| | 420 | } |
| | 421 | } |
| | 422 | while (timeout > 0 && bytesAvail == 0); |
| | 423 | |
| | 424 | if (bytesAvail == SSH_ERROR) { |
| | 425 | qWarning() << "Poll returns error:" << ssh_get_error(m_session); |
| | 426 | channel_close(channel); |
| | 427 | channel_free(channel); |
| | 428 | END; |
| | 429 | return false; |
| | 430 | } |
| | 431 | |
| | 432 | while ((bytesAvail = channel_read(channel, buffer, sizeof(buffer), 0)) > 0) { |
| | 433 | ossout.write(buffer,bytesAvail); |
| 415 | 434 | } |
| 416 | 435 | stdout_str = QString(ossout.str().c_str()); |
| 417 | | while ((len = channel_read(channel, buffer, sizeof(buffer), 1)) > 0) { |
| 418 | | osserr.write(buffer,len); |
| | 436 | while ((bytesAvail = channel_read(channel, buffer, sizeof(buffer), 1)) > 0) { |
| | 437 | osserr.write(buffer,bytesAvail); |
| 419 | 438 | } |
| 420 | 439 | stderr_str = QString(osserr.str().c_str()); |
-
|
r895efff6
|
r1a1332b7
|
|
| 791 | 791 | void QueueManager::killStructure(Structure *s) { |
| 792 | 792 | // End job if currently running |
| | 793 | s->lock()->lockForWrite(); |
| | 794 | s->stopOptTimer(); |
| 793 | 795 | if ( s->getStatus() != Structure::Optimized ) { |
| 794 | | s->lock()->lockForWrite(); |
| 795 | | s->stopOptTimer(); |
| 796 | 796 | s->setStatus(Structure::Killed); |
| 797 | | s->lock()->unlock(); |
| 798 | 797 | } |
| 799 | 798 | else { |
| 800 | | s->lock()->lockForWrite(); |
| 801 | | s->stopOptTimer(); |
| 802 | 799 | s->setStatus(Structure::Removed); |
| 803 | | s->lock()->unlock(); |
| 804 | | } |
| | 800 | } |
| | 801 | s->lock()->unlock(); |
| 805 | 802 | stopJob(s); |
| 806 | 803 | emit structureKilled(s); |
| … |
… |
|
| 877 | 874 | void QueueManager::stopJob(Structure *s) |
| 878 | 875 | { |
| | 876 | m_jobStartTracker.lockForWrite(); |
| | 877 | m_jobStartTracker.remove(s); |
| | 878 | m_jobStartTracker.unlock(); |
| 879 | 879 | m_opt->queueInterface()->stopJob(s); |
| 880 | 880 | } |
| … |
… |
|
| 971 | 971 | "The requested structures counter has become negative."); |
| 972 | 972 | |
| 973 | | qDebug() << "New structure accepted (" << s->getIDString() << ")"; |
| | 973 | qDebug() << "New structure received (" << s->getIDString() << ")"; |
| 974 | 974 | |
| 975 | 975 | m_newStructureTracker.unlock(); |
| … |
… |
|
| 1001 | 1001 | |
| 1002 | 1002 | m_tracker->append(s); |
| | 1003 | qDebug() << "New structure accepted (" << s->getIDString() << ")"; |
| 1003 | 1004 | |
| 1004 | 1005 | m_newStructureTracker.unlock(); |
-