… | |
… | |
121 | } |
121 | } |
122 | |
122 | |
123 | BEGIN { |
123 | BEGIN { |
124 | $SIG{__DIE__} = sub { |
124 | $SIG{__DIE__} = sub { |
125 | return if $^S; |
125 | return if $^S; |
126 | crash ("CRASH/DIE: $_[0]" => 1); |
126 | crash "CRASH/DIE: $_[0]" => 1; |
127 | DC::fatal Carp::longmess "$_[0]"; |
127 | DC::fatal Carp::longmess "$_[0]"; |
128 | } |
128 | } |
129 | } |
129 | } |
130 | |
130 | |
131 | use DC::OpenGL (); |
131 | use DC::OpenGL (); |
… | |
… | |
145 | |
145 | |
146 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
146 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
147 | $SIG{PIPE} = 'IGNORE'; |
147 | $SIG{PIPE} = 'IGNORE'; |
148 | |
148 | |
149 | $EV::DIED = sub { |
149 | $EV::DIED = sub { |
150 | crash ("CRASH/EV::DIED: $@" => 1); |
150 | crash "CRASH/EV::DIED: $@" => 1; |
151 | DC::fatal Carp::longmess $@; |
151 | DC::fatal Carp::longmess $@; |
152 | }; |
152 | }; |
153 | |
153 | |
154 | my $MAX_FPS = 60; |
154 | my $MAX_FPS = 60; |
155 | |
155 | |
… | |
… | |
245 | my $buf = delete $CONN->{wbuf}; |
245 | my $buf = delete $CONN->{wbuf}; |
246 | |
246 | |
247 | $buf .= pack "n/a*", "exti " . JSON::XS::encode_json [clientlog => undef, substr $msg, 0, 8000]; |
247 | $buf .= pack "n/a*", "exti " . JSON::XS::encode_json [clientlog => undef, substr $msg, 0, 8000]; |
248 | |
248 | |
249 | AnyEvent::Util::fh_nonblocking $fh, 0; |
249 | AnyEvent::Util::fh_nonblocking $fh, 0; |
250 | |
|
|
251 | syswrite $fh, $buf; |
250 | syswrite $fh, $buf; |
252 | AnyEvent::Util::fh_nonblocking $fh, 1; |
251 | AnyEvent::Util::fh_nonblocking $fh, 1; |
253 | |
252 | |
254 | $msg =~ s/\s+$//; |
253 | $msg =~ s/\s+$//; |
255 | |
254 | |
256 | # backtrace as second step, in case it crashes, too |
255 | # backtrace as second step, in case it crashes, too |
257 | crash (Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION, generated") |
256 | crash Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION, generated" |
258 | if $backtrace; |
257 | if $backtrace; |
259 | }; |
258 | }; |
260 | |
259 | |
261 | ############################################################################# |
260 | ############################################################################# |
262 | |
261 | |