Changeset 25486
- Timestamp:
- 2012-04-26T12:39:28+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb-edit/trunk/src/bin/script/TDBServer.pl
r25477 r25486 82 82 my $collection = ''; 83 83 my $no_daemon = 0; 84 my $debug = 1;84 my $debug = 0; 85 85 my $server; 86 86 my $server_host; … … 326 326 # //unlock($msg_counter); 327 327 } 328 &debugPrint($the_count, $tid, 'RECV', $data) ;328 &debugPrint($the_count, $tid, 'RECV', $data) unless !$debug; 329 329 # process special commands first 330 330 if ($data =~ /^#([arq]):(.*)$/) … … 417 417 my $payload = $4; 418 418 $payload =~ s/^\s+|\s+$//g; 419 &debugPrint($the_count, $tid, 'PARSED', 'database=' . $database . ', key=' . $key . ', action=' . $action . ', payload=' . $payload) ;419 &debugPrint($the_count, $tid, 'PARSED', 'database=' . $database . ', key=' . $key . ', action=' . $action . ', payload=' . $payload) unless !$debug; 420 420 # Build path to database file 421 421 my $tdb_path = ''; … … 438 438 my $record = '[' . $key . ']' . $action . $payload; 439 439 # Open harness to TDBCLI 440 &debugPrint($the_count, $tid, 'TDBCLI', 'Opening harness') ;440 &debugPrint($the_count, $tid, 'TDBCLI', 'Opening harness') unless !$debug; 441 441 my @tdb_command = ($tdbexe, $tdb_path, '-mid ' . $the_count); 442 442 my $buffer_to_tdb = ''; … … 455 455 } 456 456 # - read any response from TDBCLI 457 &debugPrint($the_count, $tid, 'TDBCLI', 'Reading') ;457 &debugPrint($the_count, $tid, 'TDBCLI', 'Reading') unless !$debug; 458 458 while ($buffer_from_tdb !~ /-{70}/) 459 459 { … … 461 461 } 462 462 # - explicitly tell the pipe to quit (empty key) 463 &debugPrint($the_count, $tid, 'TDBCLI', 'Closing') ;463 &debugPrint($the_count, $tid, 'TDBCLI', 'Closing') unless !$debug; 464 464 $buffer_to_tdb = "[]\n"; 465 465 while (length($buffer_to_tdb)) … … 472 472 chomp($result); 473 473 # Finished with harness 474 &debugPrint($the_count, $tid, 'TDBCLI', 'Finishing harness') ;474 &debugPrint($the_count, $tid, 'TDBCLI', 'Finishing harness') unless !$debug; 475 475 finish($tdb_harness); 476 &debugPrint($the_count, $tid, 'TDBCLI', 'Complete') ;476 &debugPrint($the_count, $tid, 'TDBCLI', 'Complete') unless !$debug; 477 477 } 478 478 # Use different TDB tools depending on arguments … … 493 493 $command1 = 'tdbget "' . $tdb_path . '" "' . $key . '"'; 494 494 } 495 &debugPrint($the_count, $tid, $command_name, 'Command: ' . $command1) ;495 &debugPrint($the_count, $tid, $command_name, 'Command: ' . $command1) unless !$debug; 496 496 $result = `$command1`; 497 &debugPrint($the_count, $tid, $command_name, 'Result: ' . $result) ;497 &debugPrint($the_count, $tid, $command_name, 'Result: ' . $result) unless !$debug; 498 498 if ($result =~ /-{70}/) 499 499 { … … 505 505 { 506 506 my $command2 = 'txt2tdb -append "' . $tdb_path . '"'; 507 &debugPrint($the_count, $tid, 'TXT2TDB', 'Command: ' . $command2) ;507 &debugPrint($the_count, $tid, 'TXT2TDB', 'Command: ' . $command2) unless !$debug; 508 508 open(my $infodb_handle, '| ' . $command2) or die("Error! Failed to open pipe to TXT2TDB\n"); 509 509 print $infodb_handle '[' . $key . ']'; … … 515 515 close($infodb_handle); 516 516 $result = "-"x70 . "\n"; 517 &debugPrint($the_count, $tid, 'TXT2TDB', 'Result: ' . $result) ;517 &debugPrint($the_count, $tid, 'TXT2TDB', 'Result: ' . $result) unless !$debug; 518 518 } 519 519 else … … 523 523 } 524 524 # Synchronized debug log writing 525 &debugPrint($the_count, $tid, 'SEND', $result) ;525 &debugPrint($the_count, $tid, 'SEND', $result) unless !$debug; 526 526 return $result; 527 527 }
Note:
See TracChangeset
for help on using the changeset viewer.