Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- method connect () {
- start {
- my $conn = await IO::Socket::Async.connect($!host, $!port);
- $!incoming = self!process-messages($conn.Supply(:bin)).share;
- say $!incoming;
- my $connected = $!incoming.grep(0xff).Promise;
- say 'done';
- await $connected;
- say 'connected'; #### I never get here.
- $!connection = $conn;
- True
- }
- }
- method !process-messages($incoming) {
- supply {
- my @chars = '';
- whenever $incoming -> $data {
- emit $data.unpack('H*');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement