Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IO::Socket::INET.accept() return an IO::Socket::INET object rather than a Parrot IO object #1381

Closed
p6rt opened this issue Oct 27, 2009 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 27, 2009

Migrated from rt.perl.org#70045 (status was 'rejected')

Searchable as RT70045$

@p6rt
Copy link
Author

p6rt commented Oct 27, 2009

From @carbin

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.

@p6rt
Copy link
Author

p6rt commented Oct 27, 2009

From @carbin

0002-Change-IO-Socket-INET.accept-to-return-an-instan.patch
From 087de23bf7c6727e405053690103196ab47323f5 Mon Sep 17 00:00:00 2001
From: Carlin Bingham <carlin@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

@p6rt
Copy link
Author

p6rt commented Oct 28, 2009

From @moritz

Carlin Bingham (via RT) wrote​:

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.

Care to elaborate on the "affect"? does it imply "break"? If so I'd like
some comments from some current users before applying...

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Oct 28, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 29, 2009

From @carbin

On Wed Oct 28 13​:43​:51 2009, moritz wrote​:

Carlin Bingham (via RT) wrote​:

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.

Care to elaborate on the "affect"? does it imply "break"? If so I'd like
some comments from some current users before applying...

Cheers,
Moritz

Yes, any application depending on that recv() to behave the way it does
will break. If the patch is applied, it should be called with a
parameter instead (or replaced with get(), once that's implemented).
Given that, at the moment, a server can't use recv with a parameter (and
won't be able to use get() once its implemented, or any other methods),
breaking backwards compatibility now would be better in favour of a
long-term win.

--
Carlin

@p6rt
Copy link
Author

p6rt commented Oct 1, 2011

From @moritz

I'm sorry that this patch didn't get applied for so long; now we have
the equivalent functionality in place anyway. So thanks and sorry.

@p6rt
Copy link
Author

p6rt commented Oct 1, 2011

@moritz - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Oct 1, 2011
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant