# New Ticket Created by  Carlin Bingham 
# Please include the string:  [perl #70045]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=70045 >


The current IO::Socket::INET.accept() returns a Parrot IO object rather
than an instance of IO::Socket::INET. This means if you do:

        my $client = $server.accept();
        $client.recv();

Parrot's recv() function is being called, not Rakudo's -- therefore you
can't use recv with a parameter or call any of IO::Socket(::INET)'s
methods.

This patch makes accept() return an instance of IO::Socket::INET with
the $!PIO attribute set to the Parrot IO object that accept() currently
returns.

This will affect applications that currently call recv() from the object
created with accept(), as Parrot's recv() returns after every send but
Rakudo's recv() (with no parameter) returns once the connection closes.
>From 087de23bf7c6727e405053690103196ab47323f5 Mon Sep 17 00:00:00 2001
From: Carlin Bingham <car...@theintersect.org>
Date: Tue, 27 Oct 2009 22:28:24 +1300
Subject: [PATCH] Change IO::Socket::INET.accept() to return an instance of IO::Socket::INET rather than a Parrot IO object

---
 src/setting/IO/Socket/INET.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/setting/IO/Socket/INET.pm b/src/setting/IO/Socket/INET.pm
index b8c7c80..ce69631 100644
--- a/src/setting/IO/Socket/INET.pm
+++ b/src/setting/IO/Socket/INET.pm
@@ -48,6 +48,6 @@ class IO::Socket::INET does IO::Socket {
     }
 
     method accept() {
-        return $!PIO.accept();
+        return IO::Socket::INET.new( :PIO( $!PIO.accept() ) );
     }
 }
-- 
1.6.0.4

Reply via email to