… | |
… | |
107 | timeout => 3600 * 2, |
107 | timeout => 3600 * 2, |
108 | name => time.rand.rand.rand, # lame |
108 | name => time.rand.rand.rand, # lame |
109 | @_, |
109 | @_, |
110 | queue => [], |
110 | queue => [], |
111 | req => {}, |
111 | req => {}, |
112 | prefix => "..:aefcpid-$rand:", |
112 | prefix => "..:aefcpid:$rand:", |
113 | idseq => "a0", |
113 | idseq => "a0", |
114 | }, $class; |
114 | }, $class; |
115 | |
115 | |
116 | { |
116 | { |
117 | Scalar::Util::weaken (my $self = $self); |
117 | Scalar::Util::weaken (my $self = $self); |
… | |
… | |
394 | } elsif (UNIVERSAL::isa $ok, AnyEvent::CondVar::) { |
394 | } elsif (UNIVERSAL::isa $ok, AnyEvent::CondVar::) { |
395 | $err = sub { $ok->croak ($_[0]{extra_description}) }; |
395 | $err = sub { $ok->croak ($_[0]{extra_description}) }; |
396 | } else { |
396 | } else { |
397 | my $bt = Carp::longmess ""; |
397 | my $bt = Carp::longmess ""; |
398 | $err = sub { |
398 | $err = sub { |
399 | die "$_[0]{extra_description}$bt"; |
399 | die "$_[0]{code_description} ($_[0]{extra_description})$bt"; |
400 | }; |
400 | }; |
401 | } |
401 | } |
402 | |
402 | |
403 | $ok ||= $NOP_CB; |
403 | $ok ||= $NOP_CB; |
404 | |
404 | |
… | |
… | |
549 | =cut |
549 | =cut |
550 | |
550 | |
551 | _txn get_plugin_info => sub { |
551 | _txn get_plugin_info => sub { |
552 | my ($self, $ok, $err, $name, $detailed) = @_; |
552 | my ($self, $ok, $err, $name, $detailed) = @_; |
553 | |
553 | |
|
|
554 | my $id = $self->identifier; |
|
|
555 | |
554 | $self->send_msg (get_plugin_info => |
556 | $self->send_msg (get_plugin_info => |
|
|
557 | identifier => $id, |
555 | plugin_name => $name, |
558 | plugin_name => $name, |
556 | detailed => $detailed ? "true" : "false", |
559 | detailed => $detailed ? "true" : "false", |
557 | id_cb => sub { |
|
|
558 | my ($self, $type, $kv, $rdata) = @_; |
|
|
559 | |
|
|
560 | $ok->($kv); |
|
|
561 | 1 |
|
|
562 | }, |
|
|
563 | ); |
560 | ); |
|
|
561 | $self->on (sub { |
|
|
562 | my ($self, $type, $kv) = @_; |
|
|
563 | |
|
|
564 | if ($kv->{identifier} eq $id) { |
|
|
565 | if ($type eq "get_plugin_info") { |
|
|
566 | $ok->($kv); |
|
|
567 | } else { |
|
|
568 | $err->($kv, $type); |
|
|
569 | } |
|
|
570 | return; |
|
|
571 | } |
|
|
572 | |
|
|
573 | 1 |
|
|
574 | }); |
564 | }; |
575 | }; |
565 | |
576 | |
566 | =item $status = $fcp->client_get ($uri, $identifier, %kv) |
577 | =item $status = $fcp->client_get ($uri, $identifier, %kv) |
567 | |
578 | |
568 | %kv can contain (L<http://wiki.freenetproject.org/FCP2p0ClientGet>). |
579 | %kv can contain (L<http://wiki.freenetproject.org/FCP2p0ClientGet>). |