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.14 by root, Fri Oct 12 19:13:26 2007 UTC vs.
Revision 1.19 by root, Sun Jan 13 08:56:23 2008 UTC

29reload_archetypes & 29reload_archetypes &
30ext::help::reload & 30ext::help::reload &
31ext::books::reload & 31ext::books::reload &
32ext::map_tags::reload & 32ext::map_tags::reload &
33ext::map_world::reload & 33ext::map_world::reload &
34print JSON::XS->new->pretty->encode({cf::mallinfo})
34EOF 35EOF
35 print $fh "\n> "; 36 print $fh "\n> ";
36 37
37 Event->io (fd => $fh, poll => 'r', data => 0, cb => sub { 38 my $iow; $iow = EV::io $fh, EV::READ, sub {
38 if (defined (my $cmd = <$fh>)) { 39 if (defined (my $cmd = <$fh>)) {
39 $cmd =~ s/\s+$//; 40 $cmd =~ s/\s+$//;
40 41
41 if ($cmd =~ /^\s*exit\b/i) { 42 if ($cmd =~ /^\s*exit\b/i) {
42 print $fh "will not exit() server.\n"; 43 print $fh "will not exit() server.\n";
47 } else { 48 } else {
48 my $sub = sub { 49 my $sub = sub {
49 package cf; 50 package cf;
50 select $fh; 51 select $fh;
51 52
52 # compile first, the execute, as Coro does not support switching in eval string 53 # compile first, then execute, as Coro does not support switching in eval string
53 my $cb = eval "sub { $cmd }"; 54 my $cb = eval "sub { $cmd \n}";
54 55
55 my $t1 = Time::HiRes::time; 56 my $t1 = Time::HiRes::time;
56 my @res = $@ ? () : eval { $cb->() }; 57 my @res = $@ ? () : eval { $cb->() };
57 my $t2 = Time::HiRes::time; 58 my $t2 = Time::HiRes::time;
58 59
77 } 78 }
78 } 79 }
79 80
80 print $fh "\n> "; 81 print $fh "\n> ";
81 } else { 82 } else {
82 $_[0]->w->cancel; 83 undef $iow;
83 } 84 }
84 }); 85 };
85} 86}
87
88our $LISTENER;
86 89
87# now a shell listening on a tcp-port - let the firewall decide access rights 90# now a shell listening on a tcp-port - let the firewall decide access rights
88if ($cf::CFG{perl_shell}) { 91if ($cf::CFG{perl_shell}) {
89 if (my $listen = new IO::Socket::INET LocalAddr => $cf::CFG{perl_shell}, Listen => 1, ReuseAddr => 1) { 92 if (my $listen = new IO::Socket::INET LocalAddr => $cf::CFG{perl_shell}, Listen => 1, ReuseAddr => 1, Blocking => 0) {
90 Event->io (fd => $listen, poll => 'r', data => cf::WF_AUTOCANCEL, cb => sub { tcp_serve $listen->accept }); 93 $LISTENER = EV::io $listen, EV::READ, sub { tcp_serve $listen->accept };
91 } 94 }
92} 95}
93 96
94 97

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines