This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 196453
Collapse All | Expand All

(-)a/cnd.remote/src/org/netbeans/modules/cnd/remote/sync/RfsLocalController.java (-3 / +33 lines)
Lines 276-281 Link Here
276
        shutdown();
276
        shutdown();
277
    }
277
    }
278
278
279
    @SuppressWarnings("CallToThreadDumpStack")
279
    private void shutdown() {
280
    private void shutdown() {
280
        // this try-catch is only for investigation of the instable test failures
281
        // this try-catch is only for investigation of the instable test failures
281
        try {
282
        try {
Lines 458-471 Link Here
458
        }
459
        }
459
    }
460
    }
460
461
462
    private boolean checkVersion(char version) throws IOException {
463
        String versionsString = requestReader.readLine();
464
        if (versionsString == null) {
465
            return false;
466
        }
467
        String versionsPattern = "VERSIONS ";
468
        if (!versionsString.startsWith(versionsPattern)) {
469
            if (err != null) {
470
                err.printf("Protocol error, expected %s, got %s\n", versionsPattern, versionsString); //NOI18N
471
            }
472
            return false;
473
        }
474
        String[] versionsArray = versionsString.substring(versionsPattern.length()).split(" ");
475
        for (String v : versionsArray) {
476
            if (v.length() != 1) {
477
                if (err != null) {
478
                    err.printf("Protocol error: incorrect version format: %s\n", versionsString); //NOI18N
479
                }
480
                return false;
481
            }
482
            if (v.charAt(0) == version) {
483
                return true;
484
            }
485
        }
486
        return true;
487
    }
488
    
461
    /**
489
    /**
462
     * Feeds remote controller with the list of files and their lengths
490
     * Feeds remote controller with the list of files and their lengths
463
     * @return true in the case of success, otherwise false
491
     * @return true in the case of success, otherwise false
464
     * NB: in the case false is returned, no shutdown will be called
492
     * NB: in the case false is returned, no shutdown will be called
465
     */
493
     */
466
    boolean init() {
494
    boolean init() throws IOException {
467
495
        char version = USE_TIMESTAMPS ? '4' : '3';
468
        char version = USE_TIMESTAMPS ? '2' : '1';
496
        if (!checkVersion(version)) {
497
            return false;
498
        }        
469
        logger.log(Level.FINE, "Initialization. Version=%c", version);
499
        logger.log(Level.FINE, "Initialization. Version=%c", version);
470
        if (CHECK_ALIVE && !ProcessUtils.isAlive(remoteControllerProcess)) { // fixup for remote tests unstable failure (caused by jsch issue)
500
        if (CHECK_ALIVE && !ProcessUtils.isAlive(remoteControllerProcess)) { // fixup for remote tests unstable failure (caused by jsch issue)
471
            if (err != null) {
501
            if (err != null) {
(-)a/cnd.remote/src/org/netbeans/modules/cnd/remote/sync/RfsSyncWorker.java (-6 lines)
Lines 180-191 Link Here
180
                executionEnvironment, files, remoteControllerProcess, rcInputStreamReader,
180
                executionEnvironment, files, remoteControllerProcess, rcInputStreamReader,
181
                rcOutputStreamWriter, err, privProjectStorageDir);
181
                rcOutputStreamWriter, err, privProjectStorageDir);
182
182
183
        // A workaround for #196453 - Can not build remote project: protocol error
184
        int sleep = Integer.getInteger("rfs.instable.sleep", 200); // NOI18N
185
        if (sleep > 0) {
186
            Thread.sleep(sleep);
187
        }
188
189
        if (!localController.init()) {
183
        if (!localController.init()) {
190
            remoteControllerProcess.destroy();
184
            remoteControllerProcess.destroy();
191
            return false;
185
            return false;
(-)a/cnd.remote/tools/rfs_controller.c (-3 / +5 lines)
Lines 59-66 Link Here
59
static int emulate = false;
59
static int emulate = false;
60
60
61
enum  {
61
enum  {
62
    VERSION_1 = '1',
62
    VERSION_1 = '3',
63
    VERSION_2 = '2'
63
    VERSION_2 = '4'
64
} protocol_version = 0;
64
} protocol_version = 0;
65
65
66
typedef struct connection_data {
66
typedef struct connection_data {
Lines 426-432 Link Here
426
}
426
}
427
427
428
static int init() {
428
static int init() {
429
    trace("Initialization\n");
429
    trace("Initialization. Sending supported versions: %c %c\n", VERSION_1, VERSION_2);
430
    fprintf(stdout, "VERSIONS %c %c\n", VERSION_1, VERSION_2);
431
    fflush(stdout);
430
    int bufsize = 256;
432
    int bufsize = 256;
431
    char buffer[bufsize];
433
    char buffer[bufsize];
432
    if(fgets(buffer, bufsize, stdin)) {
434
    if(fgets(buffer, bufsize, stdin)) {

Return to bug 196453