Project

General

Profile

0002-LightyTest.pm-do-not-shutdown-testing-socket_patch.txt

mackyle, 2015-12-03 22:34

 
1
From 973133672d9a4f6aae5907c42effa1369ba3de79 Mon Sep 17 00:00:00 2001
2
From: "Kyle J. McKay" <mackyle@gmail.com>
3
Date: Thu, 3 Dec 2015 11:20:30 -0800
4
Subject: [PATCH] LightyTest.pm: do not shutdown testing socket
5

    
6
While shutting down the sending side of a socket after having
7
sent the last of the data should not interfere with any future
8
reception of new data on the same socket, on darwin it does.
9

    
10
If the socket is shutdown for sending, it will fail to receive
11
any future data from the other end as well unless it already
12
just happens to be in the receive buffer waiting to be read.
13

    
14
Prevent this problem by skipping the socket shutdown on the
15
darwin platform which allows the tests to run to normal
16
completion and pass.
17

    
18
It's unclear whether or not this problem is limited only to
19
Perl or is system wide.
20

    
21
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
22
---
23
 tests/LightyTest.pm | 2 +-
24
 1 file changed, 1 insertion(+), 1 deletion(-)
25

    
26
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm
27
index d8850a37..7d40b7c0 100644
28
--- a/tests/LightyTest.pm
29
+++ b/tests/LightyTest.pm
30
@@ -223,7 +223,7 @@ sub handle_http {
31
 			print $remote $_.$BLANK;
32
 			diag("\n<< ".$_) if $is_debug;
33
 		}
34
-		shutdown($remote, 1); # I've stopped writing data
35
+		shutdown($remote, 1) unless $^O eq "darwin"; # I've stopped writing data
36
 	} else {
37
 		diag("\nsending request header to ".$host.":".$self->{PORT}) if $is_debug;
38
 		foreach(@request) {
39
-- 
40
2.4.10
41