Advertisement
Guest User

Untitled

a guest
Jan 18th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. method connect () {
  2. start {
  3. my $conn = await IO::Socket::Async.connect($!host, $!port);
  4.  
  5. $!incoming = self!process-messages($conn.Supply(:bin)).share;
  6. say $!incoming;
  7. my $connected = $!incoming.grep(0xff).Promise;
  8.  
  9. say 'done';
  10. await $connected;
  11. say 'connected'; #### I never get here.
  12. $!connection = $conn;
  13. True
  14. }
  15. }
  16.  
  17. method !process-messages($incoming) {
  18. supply {
  19. my @chars = '';
  20. whenever $incoming -> $data {
  21. emit $data.unpack('H*');
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement