Skip to content

Commit

Permalink
Fix Socket::INET to re-use the appropriate attribute from its parent …
Browse files Browse the repository at this point in the history
…class.
  • Loading branch information
tene committed Aug 3, 2009
1 parent 91408af commit 18598de
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/setting/IO/Socket/INET.pm
@@ -1,7 +1,5 @@
class IO::Socket::INET does IO::Socket {

has $!listener;

method open (Str $hostname, Int $port) {

Q:PIR {
Expand Down Expand Up @@ -34,22 +32,22 @@ class IO::Socket::INET does IO::Socket {
}

method socket(Int $domain, Int $type, Int $protocol) {
my $listener := Q:PIR {{ %r = root_new ['parrot';'Socket'] }};
$listener.socket($domain, $type, $protocol);
return IO::Socket::INET.new( :listener($listener) );
my $PIO := Q:PIR {{ %r = root_new ['parrot';'Socket'] }};
$PIO.socket($domain, $type, $protocol);
return IO::Socket::INET.new( :PIO($PIO) );
}

method bind($host, $port) {
$!listener.bind($!listener.sockaddr($host, $port));
$!PIO.bind($!PIO.sockaddr($host, $port));
return self;
}

method listen() {
$!listener.listen(1);
$!PIO.listen(1);
return self;
}

method accept() {
return $!listener.accept();
return $!PIO.accept();
}
}

0 comments on commit 18598de

Please sign in to comment.