Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

IOLoop doesn't close a connection on drop #173

Closed
wants to merge 1 commit into from

2 participants

Sergii Zasenko Sebastian Riedel
Sergii Zasenko

IOLoop doesn't close a connection on drop

Sergii Zasenko

There is a typo on line 141: my $not_connected = 1;
Just missed it when renamed a var. In any case the bug exists.

Sebastian Riedel
Owner

Not a bug, dropping a connection can take multiple ticks.

Sebastian Riedel kraih closed this
Sergii Zasenko

But why IOLoop accepts new connections after ->drop() where called?

Sebastian Riedel
Owner

Thanks, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 25, 2011
  1. Sergii Zasenko

    IOLoop doesn't drop a connection

    und3f authored
This page is out of date. Refresh to see the latest.
Showing with 31 additions and 1 deletion.
  1. +31 −1 t/mojo/ioloop.t
32 t/mojo/ioloop.t
View
@@ -6,7 +6,7 @@ use warnings;
# Disable IPv6, epoll and kqueue
BEGIN { $ENV{MOJO_NO_IPV6} = $ENV{MOJO_POLL} = 1 }
-use Test::More tests => 11;
+use Test::More tests => 12;
use_ok 'Mojo::IOLoop';
@@ -123,4 +123,34 @@ Mojo::IOLoop->idle(sub { Mojo::IOLoop->stop if $idle++ });
Mojo::IOLoop->start;
is $idle, 2, 'two idle ticks';
+$port = Mojo::IOLoop->generate_port;
+$id = $loop->listen(port => $port);
+$loop->connect(
+ address => 'localhost',
+ port => $port,
+ on_connect => sub {
+ my $loop = shift;
+ $loop->drop($id);
+ $loop->stop;
+ }
+);
+
+$loop->start;
+
+my $not_connected;
+$loop->connect(
+ address => 'localhost',
+ port => $port,
+ on_error => sub { shift->stop },
+ on_connect => sub {
+ my $loop = shift;
+ $not_connected = 0;
+ $loop->stop;
+ }
+);
+
+$loop->start;
+
+ok $not_connected;
+
__DATA__
Something went wrong with that request. Please try again.