Changeset 25453
- Timestamp:
- 2012-04-23T09:33:00+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb-edit/trunk/src/bin/script/TDBServer.pl
r25414 r25453 91 91 my $debug_log :shared = 0; 92 92 93 my $msg_counter :shared = 0; 94 93 95 print "===== TDB Server =====\n"; 94 96 print "Provides a server to allow multiple remote machines to simultaenously\n"; … … 218 220 port=>$server_port, 219 221 thread_count=>$server_threads, 220 #main_cb => \&exitCheck,222 main_cb => \&exitCheck, 221 223 processor_cb => \&process); 222 224 … … 279 281 { 280 282 my $counter = shift @_; 281 print "[DEBUG] Has parent process gone away? [" . $parent_pid . "]\n";283 #rint "[DEBUG] Has parent process gone away? [" . $parent_pid . "]\n"; 282 284 # Parent PID not available or we aren't allowed to talk to it (debugging) 283 285 if ($parent_pid == 0) … … 420 422 } 421 423 # Open harness to TDBCLI 422 my @tdb_command = ($tdbexe, $tdb_path); 424 my $the_count = 0; 425 { 426 lock($msg_counter); 427 $msg_counter++; 428 $the_count = $msg_counter + 0; 429 # //unlock($msg_counter); 430 } 431 my @tdb_command = ($tdbexe, $tdb_path, '-mid ' . $the_count); 423 432 my $buffer_to_tdb = ''; 424 433 my $buffer_from_tdb = ''; 425 434 my $tdb_harness = start(\@tdb_command, \$buffer_to_tdb, \$buffer_from_tdb); 426 435 # Check the harness worked 436 427 437 if (!pumpable $tdb_harness) 428 438 { … … 431 441 # - write the data to the TDBCLI 432 442 $buffer_to_tdb = $record . "\n"; 433 pump($tdb_harness) while (length($buffer_to_tdb)); 443 my $write_msg = '#' . $the_count . ' writing: |' . $record . '| => '; 444 while (length($buffer_to_tdb)) 445 { 446 $write_msg .='.'; 447 pump($tdb_harness); 448 } 449 print STDERR $write_msg . "\n"; 434 450 # - read any response from TDBCLI 435 pump($tdb_harness) until ($buffer_from_tdb =~ /-{70}/); 451 my $read_msg = '#' . $the_count . ' reading: '; 452 while ($buffer_from_tdb !~ /-{70}/) 453 { 454 $read_msg .= '.'; 455 pump($tdb_harness); 456 } 457 print STDERR $read_msg . ' => |' . $buffer_from_tdb . "|\n"; 436 458 # - not that this result doesn't include the [Server] prefix as it 437 459 # may be parsed for data by the client
Note:
See TracChangeset
for help on using the changeset viewer.