{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1754240636,
"reponame":"openssl",
"desc":"OpenSSL",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"3e285e9a0a694e55975be8fe63c16b51",
"commit": {"type":"commit",
"time": 1516352972,
"time_ofs": 60,
"oid_tree": { "oid": "3963435cef8dd4cedec7cf2e1c322ff0f87be6bf", "alias": []},
"oid":{ "oid": "c7454e1af74b1b99f3f47f782a6ac484c4c55b7f", "alias": []},
"msg": "Create one permanent proxy socket per TLSProxy::Proxy instance",
"sig_commit": { "git_time": { "time": 1516352972, "offset": 60 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" },
"sig_author": { "git_time": { "time": 1516184567, "offset": 60 }, "name": "Richard Levitte", "email": "levitte@openssl.org", "md5": "b737120f0642a6a5c30c6291e6170c77" }},
"body": "Create one permanent proxy socket per TLSProxy::Proxy instance\n\nOn Windows, we sometimes see a behavior with SO_REUSEADDR where there\nremains lingering listening sockets on the same address and port as a\nnewly created one.\n\nTo avoid this scenario, we don't create a new proxy port for each new\nclient run. Instead, we create one proxy socket when the proxy object\nis created, and close it when destroying that object.\n\nReviewed-by: Bernd Edlinger \u003cbernd.edlinger@hotmail.de\u003e\n(Merged from https://github.com/openssl/openssl/pull/5095)\n"
,
"diff": "diff --git a/util/perl/TLSProxy/Proxy.pm b/util/perl/TLSProxy/Proxy.pm\nindex 8c7b6d6..ca49b33 100644\n--- a/util/perl/TLSProxy/Proxy.pm\n+++ b/util/perl/TLSProxy/Proxy.pm\n@@ -101,9 +101,35 @@ sub new\n }\n }\n \n+ # Create the Proxy socket\n+ my $proxaddr \u003d $self-\u003e{proxy_addr};\n+ $proxaddr \u003d~ s/[\u005c[\u005c]]//g; # Remove [ and ]\n+ my @proxyargs \u003d (\n+ LocalHost \u003d\u003e $proxaddr,\n+ LocalPort \u003d\u003e $self-\u003e{proxy_port},\n+ Proto \u003d\u003e \u0022tcp\u0022,\n+ Listen \u003d\u003e SOMAXCONN,\n+ );\n+ push @proxyargs, ReuseAddr \u003d\u003e 1\n+ unless $^O eq \u0022MSWin32\u0022;\n+ $self-\u003e{proxy_sock} \u003d $IP_factory-\u003e(@proxyargs);\n+\n+ if ($self-\u003e{proxy_sock}) {\n+ print \u0022Proxy started on port \u0022.$self-\u003e{proxy_port}.\u0022\u005cn\u0022;\n+ } else {\n+ warn \u0022Failed creating proxy socket (\u0022.$proxaddr.\u0022,\u0022.$self-\u003e{proxy_port}.\u0022): $!\u005cn\u0022;\n+ }\n+\n return bless $self, $class;\n }\n \n+sub DESTROY\n+{\n+ my $self \u003d shift;\n+\n+ $self-\u003e{proxy_sock}-\u003eclose() if $self-\u003e{proxy_sock};\n+}\n+\n sub clearClient\n {\n my $self \u003d shift;\n@@ -155,6 +181,10 @@ sub start\n my ($self) \u003d shift;\n my $pid;\n \n+ if ($self-\u003e{proxy_sock} \u003d\u003d 0) {\n+ return 0;\n+ }\n+\n $pid \u003d fork();\n if ($pid \u003d\u003d 0) {\n my $execcmd \u003d $self-\u003eexecute\n@@ -186,26 +216,6 @@ sub clientstart\n my ($self) \u003d shift;\n my $oldstdout;\n \n- # Create the Proxy socket\n- my $proxaddr \u003d $self-\u003eproxy_addr;\n- $proxaddr \u003d~ s/[\u005c[\u005c]]//g; # Remove [ and ]\n- my @proxyargs \u003d (\n- LocalHost \u003d\u003e $proxaddr,\n- LocalPort \u003d\u003e $self-\u003eproxy_port,\n- Proto \u003d\u003e \u0022tcp\u0022,\n- Listen \u003d\u003e SOMAXCONN,\n- );\n- push @proxyargs, ReuseAddr \u003d\u003e 1\n- unless $^O eq \u0022MSWin32\u0022;\n- my $proxy_sock \u003d $IP_factory-\u003e(@proxyargs);\n-\n- if ($proxy_sock) {\n- print \u0022Proxy started on port \u0022.$self-\u003eproxy_port.\u0022\u005cn\u0022;\n- } else {\n- warn \u0022Failed creating proxy socket (\u0022.$proxaddr.\u0022,\u0022.$self-\u003eproxy_port.\u0022): $!\u005cn\u0022;\n- return 0;\n- }\n-\n if ($self-\u003eexecute) {\n my $pid \u003d fork();\n if ($pid \u003d\u003d 0) {\n@@ -240,7 +250,7 @@ sub clientstart\n \n # Wait for incoming connection from client\n my $client_sock;\n- if(!($client_sock \u003d $proxy_sock-\u003eaccept())) {\n+ if(!($client_sock \u003d $self-\u003e{proxy_sock}-\u003eaccept())) {\n warn \u0022Failed accepting incoming connection: $!\u005cn\u0022;\n return 0;\n }\n@@ -324,9 +334,6 @@ sub clientstart\n #Closing this also kills the child process\n $client_sock-\u003eclose();\n }\n- if($proxy_sock) {\n- $proxy_sock-\u003eclose();\n- }\n if(!$self-\u003edebug) {\n select($oldstdout);\n }\n@@ -436,24 +443,18 @@ sub supports_IPv6\n my $self \u003d shift;\n return $have_IPv6;\n }\n-\n-#Read/write accessors\n sub proxy_addr\n {\n my $self \u003d shift;\n- if (@_) {\n- $self-\u003e{proxy_addr} \u003d shift;\n- }\n return $self-\u003e{proxy_addr};\n }\n sub proxy_port\n {\n my $self \u003d shift;\n- if (@_) {\n- $self-\u003e{proxy_port} \u003d shift;\n- }\n return $self-\u003e{proxy_port};\n }\n+\n+#Read/write accessors\n sub server_addr\n {\n my $self \u003d shift;\n","s":{"c":1754240636,"u": 35818}}
],"g": 36959,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}