ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dm-support.ext
(Generate patch)

Comparing deliantra/server/ext/dm-support.ext (file contents):
Revision 1.12 by root, Sun Sep 30 22:33:52 2007 UTC vs.
Revision 1.14 by root, Fri Oct 12 19:13:26 2007 UTC

1#! perl 1#! perl
2 2
3use Coro::Debug; 3use Coro::Debug;
4use IO::Socket; 4use IO::Socket;
5use Storable qw/nfreeze thaw/;
6 5
7my %global; # for use by eval'ed commands 6my %global; # for use by eval'ed commands
8 7
9sub tcp_serve($) { 8sub tcp_serve($) {
10 my ($fh) = @_; 9 my ($fh) = @_;
37 36
38 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub { 37 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub {
39 if (defined (my $cmd = <$fh>)) { 38 if (defined (my $cmd = <$fh>)) {
40 $cmd =~ s/\s+$//; 39 $cmd =~ s/\s+$//;
41 40
42 select $fh;
43 if ($cmd =~ /^\s*exit\b/i) { 41 if ($cmd =~ /^\s*exit\b/i) {
44 print "will not exit() server.\n"; 42 print $fh "will not exit() server.\n";
45 } elsif ($cmd =~ s/^coro\s+// or $cmd =~ /^(?:ps|bt\s)/) { 43 } elsif ($cmd =~ s/^coro\s+// or $cmd =~ /^(?:ps|bt\s)/) {
44 select $fh;
46 Coro::Debug::command $cmd; 45 Coro::Debug::command $cmd;
46 select STDOUT;
47 } else { 47 } else {
48 my $sub = sub { 48 my $sub = sub {
49 package cf; 49 package cf;
50 select $fh; 50 select $fh;
51 51
75 } else { 75 } else {
76 $sub->(); 76 $sub->();
77 } 77 }
78 } 78 }
79 79
80 print "\n> "; 80 print $fh "\n> ";
81 select STDOUT;
82 } else { 81 } else {
83 $_[0]->w->cancel; 82 $_[0]->w->cancel;
84 } 83 }
85 }); 84 });
86} 85}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines