]>
Commit | Line | Data |
---|---|---|
30a3378a DM |
1 | package PVE::QMPClient; |
2 | ||
3 | use strict; | |
990fc5e2 | 4 | use warnings; |
7c2d9b40 | 5 | |
30a3378a DM |
6 | use IO::Multiplex; |
7 | use JSON; | |
7c2d9b40 | 8 | use POSIX qw(EINTR EAGAIN); |
b3ea07f7 | 9 | use Scalar::Util qw(weaken); |
7c2d9b40 | 10 | use Time::HiRes qw(usleep gettimeofday tv_interval); |
2ae10d4e | 11 | |
7c2d9b40 | 12 | use PVE::IPCC; |
d036e418 | 13 | use PVE::QemuServer::Helpers; |
30a3378a DM |
14 | |
15 | # Qemu Monitor Protocol (QMP) client. | |
16 | # | |
17 | # This implementation uses IO::Multiplex (libio-multiplex-perl) and | |
7a6c2150 | 18 | # allows you to issue qmp and qga commands to different VMs in parallel. |
30a3378a | 19 | |
f7d1505b | 20 | # Note: qemu can only handle 1 connection, so we close connections asap |
30a3378a DM |
21 | |
22 | sub new { | |
c5a07de5 | 23 | my ($class, $eventcb) = @_; |
30a3378a | 24 | |
f7d1505b | 25 | my $mux = IO::Multiplex->new(); |
30a3378a DM |
26 | |
27 | my $self = bless { | |
28 | mux => $mux, | |
7a6c2150 DM |
29 | queue_lookup => {}, # $fh => $queue_info |
30 | queue_info => {}, | |
30a3378a DM |
31 | }, $class; |
32 | ||
33 | $self->{eventcb} = $eventcb if $eventcb; | |
34 | ||
35 | $mux->set_callback_object($self); | |
36 | ||
558f1644 | 37 | # make sure perl doesn't believe this is a circular reference as we |
b3ea07f7 DM |
38 | # delete mux in DESTROY |
39 | weaken($mux->{_object}); | |
40 | ||
30a3378a DM |
41 | return $self; |
42 | } | |
43 | ||
7a6c2150 DM |
44 | # Note: List of special QGA command. Those commands can close the connection |
45 | # without sending a response. | |
46 | ||
47 | my $qga_allow_close_cmds = { | |
48 | 'guest-shutdown' => 1, | |
49 | 'guest-suspend-ram' => 1, | |
50 | 'guest-suspend-disk' => 1, | |
51 | 'guest-suspend-hybrid' => 1, | |
52 | }; | |
53 | ||
54 | my $push_cmd_to_queue = sub { | |
55 | my ($self, $vmid, $cmd) = @_; | |
56 | ||
57 | my $execute = $cmd->{execute} || die "no command name specified"; | |
58 | ||
59 | my $qga = ($execute =~ /^guest\-+/) ? 1 : 0; | |
a022e3fd | 60 | |
d036e418 | 61 | my $sname = PVE::QemuServer::Helpers::qmp_socket($vmid, $qga); |
7a6c2150 | 62 | |
a022e3fd | 63 | $self->{queue_info}->{$sname} = { qga => $qga, vmid => $vmid, sname => $sname, cmds => [] } |
7a6c2150 DM |
64 | if !$self->{queue_info}->{$sname}; |
65 | ||
66 | push @{$self->{queue_info}->{$sname}->{cmds}}, $cmd; | |
67 | ||
68 | return $self->{queue_info}->{$sname}; | |
69 | }; | |
70 | ||
558f1644 | 71 | # add a single command to the queue for later execution |
30a3378a DM |
72 | # with queue_execute() |
73 | sub queue_cmd { | |
74 | my ($self, $vmid, $callback, $execute, %params) = @_; | |
75 | ||
76 | my $cmd = {}; | |
77 | $cmd->{execute} = $execute; | |
78 | $cmd->{arguments} = \%params; | |
79 | $cmd->{callback} = $callback; | |
80 | ||
7a6c2150 DM |
81 | &$push_cmd_to_queue($self, $vmid, $cmd); |
82 | ||
d1c1af4b | 83 | return; |
30a3378a DM |
84 | } |
85 | ||
86 | # execute a single command | |
87 | sub cmd { | |
f0002f62 | 88 | my ($self, $vmid, $cmd, $timeout) = @_; |
30a3378a DM |
89 | |
90 | my $result; | |
91 | ||
92 | my $callback = sub { | |
93 | my ($vmid, $resp) = @_; | |
94 | $result = $resp->{'return'}; | |
1928c201 | 95 | $result = { error => $resp->{'error'} } if !defined($result) && $resp->{'error'}; |
30a3378a DM |
96 | }; |
97 | ||
7a6c2150 | 98 | die "no command specified" if !($cmd && $cmd->{execute}); |
f0002f62 | 99 | |
30a3378a DM |
100 | $cmd->{callback} = $callback; |
101 | $cmd->{arguments} = {} if !defined($cmd->{arguments}); | |
102 | ||
7a6c2150 | 103 | my $queue_info = &$push_cmd_to_queue($self, $vmid, $cmd); |
30a3378a | 104 | |
f0002f62 DM |
105 | if (!$timeout) { |
106 | # hack: monitor sometime blocks | |
107 | if ($cmd->{execute} eq 'query-migrate') { | |
108 | $timeout = 60*60; # 1 hour | |
109 | } elsif ($cmd->{execute} =~ m/^(eject|change)/) { | |
110 | $timeout = 60; # note: cdrom mount command is slow | |
cfb7a701 TL |
111 | } elsif ($cmd->{execute} eq 'guest-fsfreeze-freeze') { |
112 | # freeze syncs all guest FS, if we kill it it stays in an unfreezable | |
113 | # locked state with high probability, so use an generous timeout | |
114 | $timeout = 60*60; # 1 hour | |
115 | } elsif ($cmd->{execute} eq 'guest-fsfreeze-thaw') { | |
d11391ff FE |
116 | # While it should return instantly or never (dead locked) for Linux guests, |
117 | # the variance for Windows guests can be big. And there might be hook scripts | |
118 | # that are executed upon thaw, so use 3 minutes to be on the safe side. | |
119 | $timeout = 3 * 60; | |
46336bd2 TL |
120 | } elsif ( |
121 | $cmd->{execute} eq 'savevm-start' || | |
122 | $cmd->{execute} eq 'savevm-end' || | |
123 | $cmd->{execute} eq 'query-backup' || | |
124 | $cmd->{execute} eq 'query-block-jobs' || | |
125 | $cmd->{execute} eq 'block-job-cancel' || | |
126 | $cmd->{execute} eq 'block-job-complete' || | |
127 | $cmd->{execute} eq 'backup-cancel' || | |
128 | $cmd->{execute} eq 'query-savevm' || | |
129 | $cmd->{execute} eq 'delete-drive-snapshot' || | |
50164179 | 130 | $cmd->{execute} eq 'guest-fstrim' || |
46336bd2 TL |
131 | $cmd->{execute} eq 'guest-shutdown' || |
132 | $cmd->{execute} eq 'blockdev-snapshot-internal-sync' || | |
133 | $cmd->{execute} eq 'blockdev-snapshot-delete-internal-sync' || | |
134 | $cmd->{execute} eq 'snapshot-drive' | |
135 | ) { | |
9d689077 | 136 | $timeout = 10*60; # 10 mins ? |
14db5366 | 137 | } else { |
8174a894 TL |
138 | # NOTE: if you came here as user and want to change this, try using IO-Threads first |
139 | # which move out quite some processing of the main thread, leaving more time for QMP | |
140 | $timeout = 5; # default | |
f0002f62 DM |
141 | } |
142 | } | |
143 | ||
c8125172 | 144 | $self->queue_execute($timeout, 2); |
7a6c2150 DM |
145 | |
146 | die "VM $vmid qmp command '$cmd->{execute}' failed - $queue_info->{error}" | |
147 | if defined($queue_info->{error}); | |
30a3378a DM |
148 | |
149 | return $result; | |
150 | }; | |
151 | ||
152 | my $cmdid_seq = 0; | |
c5a07de5 | 153 | my $cmdid_seq_qga = 0; |
7a6c2150 | 154 | |
30a3378a | 155 | my $next_cmdid = sub { |
c5a07de5 WL |
156 | my ($qga) = @_; |
157 | ||
158 | if($qga){ | |
159 | $cmdid_seq_qga++; | |
160 | return "$$"."0".$cmdid_seq_qga; | |
161 | } else { | |
162 | $cmdid_seq++; | |
163 | return "$$:$cmdid_seq"; | |
164 | } | |
30a3378a DM |
165 | }; |
166 | ||
7a6c2150 DM |
167 | my $lookup_queue_info = sub { |
168 | my ($self, $fh, $noerr) = @_; | |
558f1644 | 169 | |
a022e3fd | 170 | my $queue_info = $self->{queue_lookup}->{$fh}; |
7a6c2150 DM |
171 | if (!$queue_info) { |
172 | warn "internal error - unable to lookup queue info" if !$noerr; | |
d1c1af4b | 173 | return; |
7a6c2150 DM |
174 | } |
175 | return $queue_info; | |
176 | }; | |
558f1644 | 177 | |
7a6c2150 DM |
178 | my $close_connection = sub { |
179 | my ($self, $queue_info) = @_; | |
30a3378a | 180 | |
7a6c2150 DM |
181 | if (my $fh = delete $queue_info->{fh}) { |
182 | delete $self->{queue_lookup}->{$fh}; | |
c8125172 | 183 | $self->{mux}->close($fh); |
a022e3fd | 184 | } |
30a3378a DM |
185 | }; |
186 | ||
187 | my $open_connection = sub { | |
7a6c2150 DM |
188 | my ($self, $queue_info, $timeout) = @_; |
189 | ||
190 | die "duplicate call to open" if defined($queue_info->{fh}); | |
191 | ||
192 | my $vmid = $queue_info->{vmid}; | |
193 | my $qga = $queue_info->{qga}; | |
30a3378a | 194 | |
d036e418 | 195 | my $sname = PVE::QemuServer::Helpers::qmp_socket($vmid, $qga); |
30a3378a | 196 | |
6d042176 DM |
197 | $timeout = 1 if !$timeout; |
198 | ||
2ae10d4e DM |
199 | my $fh; |
200 | my $starttime = [gettimeofday]; | |
201 | my $count = 0; | |
7a6c2150 DM |
202 | |
203 | my $sotype = $qga ? 'qga' : 'qmp'; | |
204 | ||
2ae10d4e DM |
205 | for (;;) { |
206 | $count++; | |
207 | $fh = IO::Socket::UNIX->new(Peer => $sname, Blocking => 0, Timeout => 1); | |
208 | last if $fh; | |
209 | if ($! != EINTR && $! != EAGAIN) { | |
7a6c2150 | 210 | die "unable to connect to VM $vmid $sotype socket - $!\n"; |
2ae10d4e DM |
211 | } |
212 | my $elapsed = tv_interval($starttime, [gettimeofday]); | |
6d042176 | 213 | if ($elapsed >= $timeout) { |
7a6c2150 | 214 | die "unable to connect to VM $vmid $sotype socket - timeout after $count retries\n"; |
2ae10d4e DM |
215 | } |
216 | usleep(100000); | |
217 | } | |
30a3378a | 218 | |
7a6c2150 DM |
219 | $queue_info->{fh} = $fh; |
220 | ||
221 | $self->{queue_lookup}->{$fh} = $queue_info; | |
222 | ||
30a3378a | 223 | $self->{mux}->add($fh); |
7a6c2150 | 224 | $self->{mux}->set_timeout($fh, $timeout); |
558f1644 | 225 | |
30a3378a DM |
226 | return $fh; |
227 | }; | |
228 | ||
229 | my $check_queue = sub { | |
230 | my ($self) = @_; | |
231 | ||
232 | my $running = 0; | |
558f1644 | 233 | |
7a6c2150 DM |
234 | foreach my $sname (keys %{$self->{queue_info}}) { |
235 | my $queue_info = $self->{queue_info}->{$sname}; | |
236 | my $fh = $queue_info->{fh}; | |
30a3378a DM |
237 | next if !$fh; |
238 | ||
7a6c2150 DM |
239 | my $qga = $queue_info->{qga}; |
240 | ||
241 | if ($queue_info->{error}) { | |
242 | &$close_connection($self, $queue_info); | |
30a3378a DM |
243 | next; |
244 | } | |
245 | ||
7a6c2150 | 246 | if ($queue_info->{current}) { # command running, waiting for response |
30a3378a DM |
247 | $running++; |
248 | next; | |
249 | } | |
250 | ||
7a6c2150 DM |
251 | if (!scalar(@{$queue_info->{cmds}})) { # no more commands |
252 | &$close_connection($self, $queue_info); | |
30a3378a DM |
253 | next; |
254 | } | |
255 | ||
256 | eval { | |
257 | ||
7a6c2150 DM |
258 | my $cmd = $queue_info->{current} = shift @{$queue_info->{cmds}}; |
259 | $cmd->{id} = &$next_cmdid($qga); | |
30a3378a | 260 | |
558f1644 | 261 | my $fd = -1; |
a0e7a5d0 | 262 | if ($cmd->{execute} eq 'add-fd' || $cmd->{execute} eq 'getfd') { |
558f1644 DM |
263 | $fd = $cmd->{arguments}->{fd}; |
264 | delete $cmd->{arguments}->{fd}; | |
265 | } | |
266 | ||
7a6c2150 | 267 | my $qmpcmd; |
a45a14fc | 268 | |
7a6c2150 | 269 | if ($qga) { |
a45a14fc | 270 | |
a022e3fd | 271 | $qmpcmd = to_json({ execute => 'guest-sync-delimited', |
148850f6 KT |
272 | arguments => { id => int($cmd->{id})}}) . "\n" . |
273 | to_json({ execute => $cmd->{execute}, arguments => $cmd->{arguments}}) . "\n"; | |
a45a14fc | 274 | |
7a6c2150 | 275 | } else { |
a45a14fc AD |
276 | |
277 | $qmpcmd = to_json({ | |
278 | execute => $cmd->{execute}, | |
279 | arguments => $cmd->{arguments}, | |
280 | id => $cmd->{id}}); | |
281 | } | |
30a3378a | 282 | |
558f1644 DM |
283 | if ($fd >= 0) { |
284 | my $ret = PVE::IPCC::sendfd(fileno($fh), $fd, $qmpcmd); | |
285 | die "sendfd failed" if $ret < 0; | |
286 | } else { | |
287 | $self->{mux}->write($fh, $qmpcmd); | |
288 | } | |
30a3378a DM |
289 | }; |
290 | if (my $err = $@) { | |
7a6c2150 | 291 | $queue_info->{error} = $err; |
30a3378a DM |
292 | } else { |
293 | $running++; | |
294 | } | |
295 | } | |
296 | ||
297 | $self->{mux}->endloop() if !$running; | |
298 | ||
299 | return $running; | |
300 | }; | |
301 | ||
302 | # execute all queued command | |
c8125172 | 303 | |
30a3378a | 304 | sub queue_execute { |
c8125172 | 305 | my ($self, $timeout, $noerr) = @_; |
30a3378a DM |
306 | |
307 | $timeout = 3 if !$timeout; | |
308 | ||
30a3378a | 309 | # open all necessary connections |
7a6c2150 DM |
310 | foreach my $sname (keys %{$self->{queue_info}}) { |
311 | my $queue_info = $self->{queue_info}->{$sname}; | |
312 | next if !scalar(@{$queue_info->{cmds}}); # no commands | |
a022e3fd | 313 | |
7a6c2150 DM |
314 | $queue_info->{error} = undef; |
315 | $queue_info->{current} = undef; | |
c5a07de5 | 316 | |
a022e3fd | 317 | eval { |
7a6c2150 | 318 | &$open_connection($self, $queue_info, $timeout); |
c6fb6a69 | 319 | |
7a6c2150 DM |
320 | if (!$queue_info->{qga}) { |
321 | my $cap_cmd = { execute => 'qmp_capabilities', arguments => {} }; | |
322 | unshift @{$queue_info->{cmds}}, $cap_cmd; | |
c6fb6a69 | 323 | } |
30a3378a DM |
324 | }; |
325 | if (my $err = $@) { | |
7a6c2150 | 326 | $queue_info->{error} = $err; |
30a3378a DM |
327 | } |
328 | } | |
329 | ||
330 | my $running; | |
331 | ||
332 | for (;;) { | |
333 | ||
334 | $running = &$check_queue($self); | |
335 | ||
336 | last if !$running; | |
337 | ||
338 | $self->{mux}->loop; | |
339 | } | |
340 | ||
341 | # make sure we close everything | |
c8125172 | 342 | my $errors = ''; |
7a6c2150 | 343 | foreach my $sname (keys %{$self->{queue_info}}) { |
c8125172 DM |
344 | my $queue_info = $self->{queue_info}->{$sname}; |
345 | &$close_connection($self, $queue_info); | |
346 | if ($queue_info->{error}) { | |
347 | if ($noerr) { | |
348 | warn $queue_info->{error} if $noerr < 2; | |
349 | } else { | |
350 | $errors .= $queue_info->{error} | |
351 | } | |
352 | } | |
30a3378a DM |
353 | } |
354 | ||
7a6c2150 | 355 | $self->{queue_info} = $self->{queue_lookup} = {}; |
c8125172 DM |
356 | |
357 | die $errors if $errors; | |
30a3378a DM |
358 | } |
359 | ||
b006e70b DM |
360 | sub mux_close { |
361 | my ($self, $mux, $fh) = @_; | |
362 | ||
a022e3fd | 363 | my $queue_info = &$lookup_queue_info($self, $fh, 1); |
7a6c2150 | 364 | return if !$queue_info; |
b006e70b | 365 | |
a022e3fd | 366 | $queue_info->{error} = "client closed connection\n" |
7a6c2150 | 367 | if !$queue_info->{error}; |
b006e70b DM |
368 | } |
369 | ||
c8125172 | 370 | # mux_input is called when input is available on one of the descriptors. |
30a3378a DM |
371 | sub mux_input { |
372 | my ($self, $mux, $fh, $input) = @_; | |
373 | ||
a022e3fd | 374 | my $queue_info = &$lookup_queue_info($self, $fh); |
7a6c2150 DM |
375 | return if !$queue_info; |
376 | ||
a022e3fd AL |
377 | my $sname = $queue_info->{sname}; |
378 | my $vmid = $queue_info->{vmid}; | |
7a6c2150 | 379 | my $qga = $queue_info->{qga}; |
c5a07de5 | 380 | |
7a6c2150 DM |
381 | my $curcmd = $queue_info->{current}; |
382 | die "unable to lookup current command for VM $vmid ($sname)\n" if !$curcmd; | |
a022e3fd | 383 | |
bcfbc40b AD |
384 | my $raw; |
385 | ||
7a6c2150 | 386 | if ($qga) { |
5cb6fe54 | 387 | return if $$input !~ s/^.*\xff([^\n]+}\r?\n[^\n]+})\r?\n(.*)$/$2/so; |
bcfbc40b | 388 | $raw = $1; |
c5a07de5 | 389 | } else { |
edb52f14 | 390 | return if $$input !~ s/^(.*})\r?\n(.*)$/$2/so; |
bcfbc40b AD |
391 | $raw = $1; |
392 | } | |
30a3378a | 393 | |
30a3378a DM |
394 | eval { |
395 | my @jsons = split("\n", $raw); | |
396 | ||
7a6c2150 | 397 | if ($qga) { |
bcfbc40b AD |
398 | |
399 | die "response is not complete" if @jsons != 2 ; | |
400 | ||
401 | my $obj = from_json($jsons[0]); | |
c8125172 | 402 | |
7a6c2150 | 403 | my $cmdid = $obj->{'return'}; |
bcfbc40b | 404 | die "received responsed without command id\n" if !$cmdid; |
5cb6fe54 DM |
405 | |
406 | # skip results fro previous commands | |
407 | return if $cmdid < $curcmd->{id}; | |
a022e3fd | 408 | |
bcfbc40b AD |
409 | if ($curcmd->{id} ne $cmdid) { |
410 | die "got wrong command id '$cmdid' (expected $curcmd->{id})\n"; | |
411 | } | |
412 | ||
c8125172 DM |
413 | delete $queue_info->{current}; |
414 | ||
bcfbc40b AD |
415 | $obj = from_json($jsons[1]); |
416 | ||
417 | if (my $callback = $curcmd->{callback}) { | |
418 | &$callback($vmid, $obj); | |
419 | } | |
420 | ||
421 | return; | |
422 | } | |
423 | ||
30a3378a DM |
424 | foreach my $json (@jsons) { |
425 | my $obj = from_json($json); | |
426 | next if defined($obj->{QMP}); # skip monitor greeting | |
427 | ||
428 | if (exists($obj->{error}->{desc})) { | |
429 | my $desc = $obj->{error}->{desc}; | |
430 | chomp $desc; | |
431 | die "$desc\n" if $desc !~ m/Connection can not be completed immediately/; | |
432 | next; | |
433 | } | |
434 | ||
30a3378a DM |
435 | if (defined($obj->{event})) { |
436 | if (my $eventcb = $self->{eventcb}) { | |
437 | &$eventcb($obj); | |
438 | } | |
439 | next; | |
440 | } | |
441 | ||
442 | my $cmdid = $obj->{id}; | |
443 | die "received responsed without command id\n" if !$cmdid; | |
444 | ||
30a3378a DM |
445 | if ($curcmd->{id} ne $cmdid) { |
446 | die "got wrong command id '$cmdid' (expected $curcmd->{id})\n"; | |
447 | } | |
448 | ||
c8125172 DM |
449 | delete $queue_info->{current}; |
450 | ||
30a3378a DM |
451 | if (my $callback = $curcmd->{callback}) { |
452 | &$callback($vmid, $obj); | |
453 | } | |
454 | } | |
455 | }; | |
456 | if (my $err = $@) { | |
7a6c2150 | 457 | $queue_info->{error} = $err; |
30a3378a DM |
458 | } |
459 | ||
460 | &$check_queue($self); | |
461 | } | |
462 | ||
463 | # This gets called every second to update player info, etc... | |
464 | sub mux_timeout { | |
465 | my ($self, $mux, $fh) = @_; | |
466 | ||
a022e3fd | 467 | if (my $queue_info = &$lookup_queue_info($self, $fh)) { |
7a6c2150 | 468 | $queue_info->{error} = "got timeout\n"; |
c8125172 | 469 | $self->{mux}->inbuffer($fh, ''); # clear to avoid warnings |
30a3378a DM |
470 | } |
471 | ||
472 | &$check_queue($self); | |
473 | } | |
474 | ||
1c0c1c17 WL |
475 | sub mux_eof { |
476 | my ($self, $mux, $fh, $input) = @_; | |
c8125172 | 477 | |
7a6c2150 DM |
478 | my $queue_info = &$lookup_queue_info($self, $fh); |
479 | return if !$queue_info; | |
1c0c1c17 | 480 | |
a022e3fd AL |
481 | my $sname = $queue_info->{sname}; |
482 | my $vmid = $queue_info->{vmid}; | |
7a6c2150 | 483 | my $qga = $queue_info->{qga}; |
a022e3fd | 484 | |
7a6c2150 DM |
485 | my $curcmd = $queue_info->{current}; |
486 | die "unable to lookup current command for VM $vmid ($sname)\n" if !$curcmd; | |
1c0c1c17 | 487 | |
7a6c2150 | 488 | if ($qga && $qga_allow_close_cmds->{$curcmd->{execute}}) { |
1c0c1c17 | 489 | |
5cb6fe54 | 490 | return if $$input !~ s/^.*\xff([^\n]+})\r?\n(.*)$/$2/so; |
1c0c1c17 | 491 | |
c8125172 DM |
492 | my $raw = $1; |
493 | ||
494 | eval { | |
495 | my $obj = from_json($raw); | |
1c0c1c17 | 496 | |
c8125172 DM |
497 | my $cmdid = $obj->{'return'}; |
498 | die "received responsed without command id\n" if !$cmdid; | |
7a6c2150 | 499 | |
c8125172 | 500 | delete $queue_info->{current}; |
7a6c2150 | 501 | |
c8125172 DM |
502 | if (my $callback = $curcmd->{callback}) { |
503 | &$callback($vmid, undef); | |
504 | } | |
505 | }; | |
506 | if (my $err = $@) { | |
507 | $queue_info->{error} = $err; | |
508 | } | |
1c0c1c17 | 509 | |
7a6c2150 | 510 | &$close_connection($self, $queue_info); |
c8125172 DM |
511 | |
512 | if (scalar(@{$queue_info->{cmds}}) && !$queue_info->{error}) { | |
513 | $queue_info->{error} = "Got EOF but command queue is not empty.\n"; | |
514 | } | |
1c0c1c17 | 515 | } |
1c0c1c17 WL |
516 | } |
517 | ||
56afd466 WB |
518 | sub DESTROY { |
519 | my ($self) = @_; | |
520 | ||
521 | foreach my $sname (keys %{$self->{queue_info}}) { | |
522 | my $queue_info = $self->{queue_info}->{$sname}; | |
523 | $close_connection->($self, $queue_info); | |
524 | } | |
525 | } | |
526 | ||
26f11676 | 527 | 1; |