svn commit: r21479 - in /release/trafficserver: trafficserver-7.1.1.tar.bz2 trafficserver-7.1.1.tar.bz2.asc trafficserver-7.1.1.tar.bz2.md5 trafficserver-7.1.1.tar.bz2.sha512

2017-09-05 Thread zwoop
Author: zwoop
Date: Wed Sep  6 01:53:17 2017
New Revision: 21479

Log:
ATS v7.1.1 is released

Added:
release/trafficserver/trafficserver-7.1.1.tar.bz2   (with props)
release/trafficserver/trafficserver-7.1.1.tar.bz2.asc   (with props)
release/trafficserver/trafficserver-7.1.1.tar.bz2.md5
release/trafficserver/trafficserver-7.1.1.tar.bz2.sha512

Added: release/trafficserver/trafficserver-7.1.1.tar.bz2
==
Binary file - no diff available.

Propchange: release/trafficserver/trafficserver-7.1.1.tar.bz2
--
svn:mime-type = application/x-bzip2

Added: release/trafficserver/trafficserver-7.1.1.tar.bz2.asc
==
Binary file - no diff available.

Propchange: release/trafficserver/trafficserver-7.1.1.tar.bz2.asc
--
svn:mime-type = application/pgp-signature

Added: release/trafficserver/trafficserver-7.1.1.tar.bz2.md5
==
--- release/trafficserver/trafficserver-7.1.1.tar.bz2.md5 (added)
+++ release/trafficserver/trafficserver-7.1.1.tar.bz2.md5 Wed Sep  6 01:53:17 
2017
@@ -0,0 +1 @@
+a3a9f1a70cd9d11ad5a027275643cca1 *trafficserver-7.1.1.tar.bz2

Added: release/trafficserver/trafficserver-7.1.1.tar.bz2.sha512
==
--- release/trafficserver/trafficserver-7.1.1.tar.bz2.sha512 (added)
+++ release/trafficserver/trafficserver-7.1.1.tar.bz2.sha512 Wed Sep  6 
01:53:17 2017
@@ -0,0 +1 @@
+9d3d9af85f58015a1221c74e3034a16fad3f9f4b1d55ff0271561a065282847c8c46f9d0152c6b534ab25647acddaf232e9df6228ae609c41ea7ffa8d0a84a6d
 *trafficserver-7.1.1.tar.bz2




[trafficserver] branch quic-latest updated: Prevent triggering READ_READY event on every frame

2017-09-05 Thread maskit
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new c193d32  Prevent triggering READ_READY event on every frame
c193d32 is described below

commit c193d323b0dc8e883a0f5d182319bf5e831b7f3c
Author: Masakazu Kitajo 
AuthorDate: Wed Sep 6 10:46:40 2017 +0900

Prevent triggering READ_READY event on every frame
---
 iocore/net/QUICNetVConnection.cc |  6 +++---
 iocore/net/quic/QUICApplication.cc   |  4 +++-
 iocore/net/quic/QUICStream.cc|  6 +++---
 iocore/net/quic/QUICStream.h |  2 +-
 iocore/net/quic/QUICStreamManager.cc | 11 ++-
 5 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 083dfa0..d6b233c 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -353,7 +353,7 @@ QUICNetVConnection::state_handshake(int event, Event *data)
 break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
-error = this->_state_common_send_packet();
+error = this->_state_common_send_packet();
 this->_packet_write_ready = nullptr;
 break;
   }
@@ -398,7 +398,7 @@ QUICNetVConnection::state_connection_established(int event, 
Event *data)
 break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
-error = this->_state_common_send_packet();
+error = this->_state_common_send_packet();
 this->_packet_write_ready = nullptr;
 break;
   }
@@ -459,7 +459,7 @@ QUICNetVConnection::state_connection_closed(int event, 
Event *data)
 break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
-this->_packet_write_ready = nullptr;
+this->_packet_write_ready= nullptr;
 this->next_inactivity_timeout_at = 0;
 this->next_activity_timeout_at   = 0;
 
diff --git a/iocore/net/quic/QUICApplication.cc 
b/iocore/net/quic/QUICApplication.cc
index 455459a..b65b89c 100644
--- a/iocore/net/quic/QUICApplication.cc
+++ b/iocore/net/quic/QUICApplication.cc
@@ -52,7 +52,9 @@ QUICStreamIO::read_avail()
 int64_t
 QUICStreamIO::read(uint8_t *buf, int64_t len)
 {
-  return this->_read_buffer_reader->read(const_cast(buf), len);
+  int64_t read_len = this->_read_buffer_reader->read(const_cast(buf), len);
+  this->_read_vio->ndone += read_len;
+  return read_len;
 }
 
 int64_t
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index f03dd8a..c16d0dd 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -392,10 +392,10 @@ QUICStream::reset()
   // TODO: Create a RST_STREAM frame and pass it to Stream Manager
 }
 
-bool
-QUICStream::is_read_ready()
+size_t
+QUICStream::nbytes_to_read()
 {
-  return this->_read_vio.nbytes > 0;
+  return this->_read_vio.ntodo();
 }
 
 QUICOffset
diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h
index 2f28c90..0c3e73b 100644
--- a/iocore/net/quic/QUICStream.h
+++ b/iocore/net/quic/QUICStream.h
@@ -66,7 +66,7 @@ public:
 
   void reset();
 
-  bool is_read_ready();
+  size_t nbytes_to_read();
 
   QUICOffset largest_offset_received();
   QUICOffset largest_offset_sent();
diff --git a/iocore/net/quic/QUICStreamManager.cc 
b/iocore/net/quic/QUICStreamManager.cc
index 8db20ca..6125cf9 100644
--- a/iocore/net/quic/QUICStreamManager.cc
+++ b/iocore/net/quic/QUICStreamManager.cc
@@ -132,11 +132,12 @@ QUICStreamManager::_handle_frame(const 
std::shared_ptr 
 application->set_stream(stream);
   }
 
-  QUICError error = stream->recv(frame);
-
-  // FIXME: schedule VC_EVENT_READ_READY to application every single frame?
-  // If application reading buffer continuously, do not schedule event.
-  this_ethread()->schedule_imm(application, VC_EVENT_READ_READY, stream);
+  size_t nbytes_to_read = stream->nbytes_to_read();
+  QUICError error   = stream->recv(frame);
+  // Prevent trigger read events multiple times
+  if (nbytes_to_read == 0) {
+this_ethread()->schedule_imm(application, VC_EVENT_READ_READY, stream);
+  }
 
   return error;
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: Explain how # of parents relates to fail_threshold total_connect_attempts

2017-09-05 Thread mlibbey
This is an automated email from the ASF dual-hosted git repository.

mlibbey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 38d6891  Explain how # of parents relates to fail_threshold 
total_connect_attempts
38d6891 is described below

commit 38d6891dcc4f69cf8a6d79b98b2dc6d20df192ce
Author: Miles Libbey 
AuthorDate: Thu Aug 31 12:20:35 2017 -0700

Explain how # of parents relates to fail_threshold total_connect_attempts
---
 doc/admin-guide/files/records.config.en.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index af15a77..4074f22 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -1257,7 +1257,9 @@ Parent Proxy Configuration
 
The total number of connection attempts for a specific transaction allowed 
to
a parent cache before Traffic Server bypasses the parent or fails the 
request
-   (depending on the ``go_direct`` option in the :file:`parent.config` file).
+   (depending on the ``go_direct`` option in the :file:`parent.config` file). 
The
+   number of parents tried is
+   ``proxy.config.http.parent_proxy.fail_threshold / 
proxy.config.http.parent_proxy.total_connect_attempts``
 
 .. ts:cv:: CONFIG proxy.config.http.parent_proxy.per_parent_connect_attempts 
INT 2
:reloadable:

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch master updated: test with microDNS

2017-09-05 Thread dragon
This is an automated email from the ASF dual-hosted git repository.

dragon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new 432c277  test with microDNS
432c277 is described below

commit 432c27733a144d1cb7cf61ab3bb5222accc389ec
Author: Persia Aziz 
AuthorDate: Thu Aug 31 19:08:30 2017 -0500

test with microDNS
---
 tests/bootstrap.py |  3 +-
 tests/gold_tests/autest-site/microDNS.test.ext | 77 ++
 tests/gold_tests/remap/gold/remap-DNS-200.gold | 14 +
 tests/gold_tests/remap/remap_http.test.py  | 18 +-
 tests/tools/microDNS/uDNS.py   | 28 ++
 5 files changed, 127 insertions(+), 13 deletions(-)

diff --git a/tests/bootstrap.py b/tests/bootstrap.py
index 251136b..26904b0 100755
--- a/tests/bootstrap.py
+++ b/tests/bootstrap.py
@@ -28,7 +28,8 @@ import sys
 pip_packages = [
 "autest",
 "hyper",
-"requests"
+"requests",
+"dnslib"
 ]
 
 
diff --git a/tests/gold_tests/autest-site/microDNS.test.ext 
b/tests/gold_tests/autest-site/microDNS.test.ext
new file mode 100644
index 000..f02f643
--- /dev/null
+++ b/tests/gold_tests/autest-site/microDNS.test.ext
@@ -0,0 +1,77 @@
+'''
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+from ports import get_port
+import json
+
+
+# AddRecord registers a list of ip address against hostname
+def AddRecord(self,filename,hostname,list_ip_addr):
+
+record = dict()
+record[hostname] = list_ip_addr
+return record
+
+
+#adds transaction in json format to the specified file
+def addRecordtoDNS(self,filename,hostname,list_ip_addr=[]):
+jsondata=None
+JFile = os.path.join(self.Variables.DataDir, filename)
+rec = AddRecord(self,filename,hostname,list_ip_addr)
+if not os.path.exists(os.path.dirname(JFile)):
+os.makedirs(os.path.dirname(JFile))
+if os.path.exists(JFile):
+jf = open(JFile,'r')
+jsondata = json.load(jf)
+
+if jsondata == None:
+jsondata = dict()
+jsondata["mappings"]=list()
+jsondata["mappings"].append(rec)
+jsondata["otherwise"]=list()
+jsondata["otherwise"].append("127.0.0.1")
+jsondata["otherwise"].append("127.1.1.1")
+else:
+jsondata["mappings"].append(rec)
+with open(JFile,'w+') as jf:
+jf.write(json.dumps(jsondata))
+
+
+
+def MakeDNServer(obj, name,filename,IP='127.0.0.1',rr=False,options={}):
+server_path= os.path.join(obj.Variables.AtsTestToolsDir,'microDNS/uDNS.py')
+data_dir = os.path.join(obj.RunDirectory, name)
+filepath = os.path.join(data_dir,filename)
+# create Process
+p = obj.Processes.Process(name)
+port=get_port(p,"Port")
+command = "python3 {3} {0} {1} {2}".format(IP, port,filepath,server_path)
+
+
+# create process
+p.Command = command
+p.Setup.MakeDir(data_dir)
+p.Variables.DataDir = data_dir
+p.Ready = When.PortOpen(port)
+AddMethodToInstance(p,AddRecord)
+AddMethodToInstance(p,addRecordtoDNS)
+
+return p
+
+AddTestRunSet(MakeDNServer,name="MakeDNServer")
+AddTestRunSet(MakeDNServer,name="MakeDNS")
diff --git a/tests/gold_tests/remap/gold/remap-DNS-200.gold 
b/tests/gold_tests/remap/gold/remap-DNS-200.gold
new file mode 100644
index 000..1727d4e
--- /dev/null
+++ b/tests/gold_tests/remap/gold/remap-DNS-200.gold
@@ -0,0 +1,14 @@
+``
+> GET http://testDNS.com``
+> Host: testDNS.com``
+> User-Agent: curl/``
+> Accept: */*
+``
+< HTTP/1.1 200 OK
+< Date: ``
+< Age: ``
+< Transfer-Encoding: chunked
+< Proxy-Connection: keep-alive
+< Server: ATS/``
+< 
+``
diff --git a/tests/gold_tests/remap/remap_http.test.py 
b/tests/gold_tests/remap/remap_http.test.py
index 1f840df..2543df2 100644
--- a/tests/gold_tests/remap/remap_http.test.py
+++ b/tests/gold_tests/remap/remap_http.test.py
@@ -28,6 +28,7 @@ Test.ContinueOnFail = True
 # Define default ATS
 ts = Test.MakeATSProcess("ts")
 server = Test.MakeOriginServer("server")
+dns = Test.MakeDNServer("dns", filename="dns_file.json")
 
 Test.testName = ""
 request_header = {"headers": "GET / 

[trafficserver] branch master updated: null transform test

2017-09-05 Thread dragon
This is an automated email from the ASF dual-hosted git repository.

dragon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new bc90e20  null transform test
bc90e20 is described below

commit bc90e20698a32e925dfca94a325779824326426a
Author: Zeyuan Yu 
AuthorDate: Mon Aug 28 14:39:24 2017 +

null transform test
---
 .../null_transform/gold/null_transform-200.gold|  14 +
 .../null_transform/gold/null_transform-tag.gold|   1 +
 .../null_transform/null_transform.test.py  |  84 ++
 tests/tools/plugins/null_transform.c   | 330 +
 4 files changed, 429 insertions(+)

diff --git a/tests/gold_tests/null_transform/gold/null_transform-200.gold 
b/tests/gold_tests/null_transform/gold/null_transform-200.gold
new file mode 100644
index 000..fcc57b3
--- /dev/null
+++ b/tests/gold_tests/null_transform/gold/null_transform-200.gold
@@ -0,0 +1,14 @@
+``
+> GET http://www.example.com/ HTTP/1.1
+> Host: www.example.com``
+> User-Agent: curl/``
+> Accept: */*
+> Proxy-Connection:``
+``
+< HTTP/1.1 200 OK
+< Date:``
+< Content-Length: 26
+< Age: ``
+< Proxy-Connection: keep-alive
+< Server: ATS/``
+``
diff --git a/tests/gold_tests/null_transform/gold/null_transform-tag.gold 
b/tests/gold_tests/null_transform/gold/null_transform-tag.gold
new file mode 100644
index 000..7f60846
--- /dev/null
+++ b/tests/gold_tests/null_transform/gold/null_transform-tag.gold
@@ -0,0 +1 @@
+``DIAG: (null_transform)``
\ No newline at end of file
diff --git a/tests/gold_tests/null_transform/null_transform.test.py 
b/tests/gold_tests/null_transform/null_transform.test.py
new file mode 100644
index 000..846f630
--- /dev/null
+++ b/tests/gold_tests/null_transform/null_transform.test.py
@@ -0,0 +1,84 @@
+
+'''
+'''
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+import os
+Test.Summary = '''
+Test a basic null transform plugin
+'''
+
+# Need Curl
+Test.SkipUnless(
+Condition.HasProgram("curl", "curl needs to be installed on system for 
this test to work")
+)
+Test.ContinueOnFail = True
+
+# Define default ATS
+ts = Test.MakeATSProcess("ts")
+server = Test.MakeOriginServer("server")
+
+Test.testName = ""
+request_header = {"headers": "GET / HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
+  "timestamp": "1469733493.993",
+  "body": ""
+  }
+# Expected response from origin server
+response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n",
+   "timestamp": "1469733493.993",
+
+   "body": "This is expected response."}
+
+# Add response the server dictionary
+server.addResponse("sessionfile.log", request_header, response_header)
+ts.Disk.records_config.update({
+'proxy.config.diags.debug.enabled': 1,
+'proxy.config.diags.debug.tags': 'null_transform'
+})
+ts.Disk.remap_config.AddLine(
+'map http://www.example.com 
http://127.0.0.1:{0}'.format(server.Variables.Port)
+)
+
+# Load plugin
+plugin_args = ""
+lib_dir = os.path.join(Test.Variables.AtsTestToolsDir, '../../lib')
+plugin_dir = ts.Env['PROXY_CONFIG_PLUGIN_PLUGIN_DIR']
+plugin_dir_src = os.path.join(Test.Variables.AtsTestToolsDir, 'plugins', 
'null_transform.c')
+ts.Setup.Copy(plugin_dir_src, plugin_dir)
+
+in_basename = os.path.basename(plugin_dir_src)
+in_path = os.path.join(plugin_dir, in_basename)
+out_basename = os.path.splitext(in_basename)[0] + '.so'
+out_path = os.path.join(plugin_dir, out_basename)
+
+ts.Setup.RunCommand('tsxs -c {0} -o {1} -I {2}'.format(in_path, out_path, 
lib_dir))
+ts.Disk.plugin_config.AddLine("{0} {1}".format(out_basename, plugin_args))
+
+
+# www.example.com Host
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl --proxy 127.0.0.1:{0} 
"http://www.example.com; --verbose -H "Proxy-Connection: keep-alive"'.format(
+ts.Variables.port)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.StartBefore(server)
+tr.Processes.Default.StartBefore(Test.Processes.ts)
+tr.Processes.Default.Streams.stderr = "gold/null_transform-200.gold"
+tr.StillRunningAfter = server
+
+# Check Plugin 

[trafficserver] branch quic-latest updated: Randomize initial value for packet number

2017-09-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new 913767a  Randomize initial value for packet number
913767a is described below

commit 913767ae488c7f2414545adc22bcc5fd003edba4
Author: Masaori Koshiba 
AuthorDate: Tue Sep 5 16:32:32 2017 +0900

Randomize initial value for packet number
---
 iocore/net/quic/QUICPacket.cc  | 14 ++
 iocore/net/quic/QUICPacket.h   |  3 ++-
 iocore/net/quic/test/test_QUICPacketFactory.cc |  2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 3ef847f..bfae22b 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -761,6 +761,20 @@ QUICPacketFactory::set_crypto_module(QUICCrypto *crypto)
 //
 // QUICPacketNumberGenerator
 //
+QUICPacketNumberGenerator::QUICPacketNumberGenerator()
+{
+  this->randomize();
+}
+
+QUICPacketNumber
+QUICPacketNumberGenerator::randomize()
+{
+  std::random_device rnd;
+  this->_current = rnd() & 0x7FFF;
+
+  return this->_current;
+}
+
 QUICPacketNumber
 QUICPacketNumberGenerator::next()
 {
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 326a348..147f13d 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -170,7 +170,8 @@ private:
 class QUICPacketNumberGenerator
 {
 public:
-  QUICPacketNumberGenerator(QUICPacketNumber initial_number = 0) : 
_current(initial_number){};
+  QUICPacketNumberGenerator();
+  QUICPacketNumber randomize();
   QUICPacketNumber next();
 
 private:
diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc 
b/iocore/net/quic/test/test_QUICPacketFactory.cc
index b92144b..ab989ae 100644
--- a/iocore/net/quic/test/test_QUICPacketFactory.cc
+++ b/iocore/net/quic/test/test_QUICPacketFactory.cc
@@ -65,6 +65,6 @@ TEST_CASE("QUICPacketFactory_Create_ServerCleartextPacket", 
"[quic]")
   CHECK(packet->type() == QUICPacketType::SERVER_CLEARTEXT);
   CHECK(packet->connection_id() == 0x01020304);
   CHECK(memcmp(packet->payload(), raw, sizeof(raw)) == 0);
-  CHECK(packet->packet_number() == 0);
+  CHECK((packet->packet_number() & 0x8000) == 0);
   CHECK(packet->version() == 0x11223344);
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch quic-latest updated: Schedule QUIC_EVENT_PACKET_WRITE_READY only if it's not scheduled

2017-09-05 Thread maskit
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new 368e54b  Schedule QUIC_EVENT_PACKET_WRITE_READY only if it's not 
scheduled
368e54b is described below

commit 368e54b8df5acd4c5eff21a7d29a7fec643bc04f
Author: Masakazu Kitajo 
AuthorDate: Tue Sep 5 16:24:08 2017 +0900

Schedule QUIC_EVENT_PACKET_WRITE_READY only if it's not scheduled
---
 iocore/net/P_QUICNetVConnection.h  |  2 ++
 iocore/net/QUICNetVConnection.cc   | 13 ++---
 iocore/net/quic/QUICFrameTransmitter.h |  2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 02606ea..3937017 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -220,6 +220,8 @@ private:
   Queue _packet_send_queue;
   std::queue> _frame_buffer;
 
+  Event *_packet_write_ready = nullptr;
+
   void _packetize_frames();
   std::unique_ptr 
_build_packet(ats_unique_buf buf, size_t len, bool retransmittable,

QUICPacketType type = QUICPacketType::UNINITIALIZED);
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 8cf5763..083dfa0 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -195,7 +195,9 @@ 
QUICNetVConnection::transmit_packet(std::unique_ptr_packet_send_queue.enqueue(const_cast(packet.release()));
-  eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, 
nullptr);
+  if (!this->_packet_write_ready) {
+this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, 
QUIC_EVENT_PACKET_WRITE_READY, nullptr);
+  }
 }
 
 void
@@ -242,7 +244,9 @@ 
QUICNetVConnection::transmit_frame(std::unique_ptrtype()), 
frame->size());
   this->_frame_buffer.push(std::move(frame));
-  eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, 
nullptr);
+  if (!this->_packet_write_ready) {
+this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, 
QUIC_EVENT_PACKET_WRITE_READY, nullptr);
+  }
 }
 
 void
@@ -350,6 +354,7 @@ QUICNetVConnection::state_handshake(int event, Event *data)
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
 error = this->_state_common_send_packet();
+this->_packet_write_ready = nullptr;
 break;
   }
   case EVENT_IMMEDIATE: {
@@ -394,6 +399,7 @@ QUICNetVConnection::state_connection_established(int event, 
Event *data)
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
 error = this->_state_common_send_packet();
+this->_packet_write_ready = nullptr;
 break;
   }
 
@@ -428,6 +434,7 @@ QUICNetVConnection::state_connection_closing(int event, 
Event *data)
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
 this->_state_common_send_packet();
+this->_packet_write_ready = nullptr;
 break;
   }
   default:
@@ -452,6 +459,7 @@ QUICNetVConnection::state_connection_closed(int event, 
Event *data)
 break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
+this->_packet_write_ready = nullptr;
 this->next_inactivity_timeout_at = 0;
 this->next_activity_timeout_at   = 0;
 
@@ -722,7 +730,6 @@ QUICNetVConnection::_recv_and_ack(const uint8_t *payload, 
uint16_t size, QUICPac
   std::unique_ptr ack_frame = 
this->_ack_frame_creator.create_if_needed();
   if (ack_frame != nullptr) {
 this->transmit_frame(std::move(ack_frame));
-eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, 
nullptr);
   }
 
   return error;
diff --git a/iocore/net/quic/QUICFrameTransmitter.h 
b/iocore/net/quic/QUICFrameTransmitter.h
index ce3c267..bbf478a 100644
--- a/iocore/net/quic/QUICFrameTransmitter.h
+++ b/iocore/net/quic/QUICFrameTransmitter.h
@@ -31,7 +31,7 @@ public:
   /*
* Enqueue a frame for transmission
*
-   * This sends QUIC_PACKET_WRITE_READY event.
+   * This schedules QUIC_PACKET_WRITE_READY event.
*/
   virtual void transmit_frame(std::unique_ptr 
frame) = 0;
   virtual uint32_t maximum_stream_frame_data_size() = 0;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].


[trafficserver] branch quic-latest updated: Encode/Decode packet number

2017-09-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new 4e47161  Encode/Decode packet number
4e47161 is described below

commit 4e471619c2b0d8a505beb1d7aaac148bc90da87d
Author: Masaori Koshiba 
AuthorDate: Tue Sep 5 15:52:46 2017 +0900

Encode/Decode packet number
---
 iocore/net/P_QUICNetVConnection.h  |   7 +-
 iocore/net/P_QUICPacketHandler.h   |   1 +
 iocore/net/QUICNetVConnection.cc   |  30 ++-
 iocore/net/QUICPacketHandler.cc|  36 +++-
 iocore/net/quic/Mock.h |  12 ++
 iocore/net/quic/QUICConnection.h   |  14 +-
 iocore/net/quic/QUICHandshake.cc   |   3 +-
 iocore/net/quic/QUICLossDetector.cc|   6 +
 iocore/net/quic/QUICLossDetector.h |   1 +
 iocore/net/quic/QUICPacket.cc  | 220 +++--
 iocore/net/quic/QUICPacket.h   |  73 ---
 iocore/net/quic/QUICTypes.cc   |   1 +
 iocore/net/quic/test/test_QUICLossDetector.cc  |   4 +-
 iocore/net/quic/test/test_QUICPacket.cc|  10 +-
 iocore/net/quic/test/test_QUICPacketFactory.cc |   6 +-
 iocore/net/quic/test/test_QUICVersionNegotiator.cc |   2 +-
 16 files changed, 265 insertions(+), 161 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 8ee7cdf..02606ea 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -175,6 +175,8 @@ public:
   NetVConnectionContext_t direction() override;
   SSLNextProtocolSet *next_protocol_set() override;
   void close(QUICError error) override;
+  QUICPacketNumber largest_received_packet_number() override;
+  QUICPacketNumber largest_acked_packet_number() override;
 
   // QUICConnection (QUICPacketTransmitter)
   virtual void transmit_packet(std::unique_ptr packet) override;
@@ -190,8 +192,9 @@ public:
 
 private:
   QUICConnectionId _quic_connection_id;
-  UDPConnection *_udp_con= nullptr;
-  QUICPacketHandler *_packet_handler = nullptr;
+  QUICPacketNumber _largest_received_packet_number = 0;
+  UDPConnection *_udp_con  = nullptr;
+  QUICPacketHandler *_packet_handler   = nullptr;
   QUICPacketFactory _packet_factory;
   QUICFrameFactory _frame_factory;
   QUICAckFrameCreator _ack_frame_creator;
diff --git a/iocore/net/P_QUICPacketHandler.h b/iocore/net/P_QUICPacketHandler.h
index ce77b4a..c40f255 100644
--- a/iocore/net/P_QUICPacketHandler.h
+++ b/iocore/net/P_QUICPacketHandler.h
@@ -43,6 +43,7 @@ public:
 
 private:
   void _recv_packet(int event, UDPPacket *udpPacket);
+  bool _read_connection_id(QUICConnectionId , IOBufferBlock *block);
 
   Map _connections;
   SSL_CTX *_ssl_ctx;
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index f5a15ba..8cf5763 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -232,7 +232,8 @@ QUICNetVConnection::get_transmitter_mutex()
 void
 QUICNetVConnection::push_packet(std::unique_ptr packet)
 {
-  DebugQUICCon("Type=%s Size=%u", QUICDebugNames::packet_type(packet->type()), 
packet->size());
+  DebugQUICCon("type=%s pkt_num=%" PRIu64 " size=%u", 
QUICDebugNames::packet_type(packet->type()), packet->packet_number(),
+   packet->size());
   this->_packet_recv_queue.enqueue(const_cast(packet.release()));
 }
 
@@ -506,6 +507,18 @@ QUICNetVConnection::next_protocol_set()
   return this->_next_protocol_set;
 }
 
+QUICPacketNumber
+QUICNetVConnection::largest_received_packet_number()
+{
+  return this->_largest_received_packet_number;
+}
+
+QUICPacketNumber
+QUICNetVConnection::largest_acked_packet_number()
+{
+  return this->_loss_detector->largest_acked_packet_number();
+}
+
 QUICError
 
QUICNetVConnection::_state_handshake_process_initial_client_packet(std::unique_ptr packet)
 {
@@ -684,6 +697,10 @@ QUICNetVConnection::_packetize_frames()
 QUICError
 QUICNetVConnection::_recv_and_ack(const uint8_t *payload, uint16_t size, 
QUICPacketNumber packet_num)
 {
+  if (packet_num > this->_largest_received_packet_number) {
+this->_largest_received_packet_number = packet_num;
+  }
+
   bool should_send_ack;
 
   QUICError error;
@@ -718,15 +735,16 @@ QUICNetVConnection::_build_packet(ats_unique_buf buf, 
size_t len, bool retransmi
 
   switch (type) {
   case QUICPacketType::SERVER_CLEARTEXT:
-packet = 
this->_packet_factory.create_server_cleartext_packet(this->_quic_connection_id, 
std::move(buf), len, retransmittable);
+packet = 

[trafficserver] branch quic-latest updated: Add packet number encoder and decoder

2017-09-05 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
 new 9af58ef  Add packet number encoder and decoder
9af58ef is described below

commit 9af58ef1f308ea6481a2878770c4b9c5b210e50e
Author: Masaori Koshiba 
AuthorDate: Tue Sep 5 09:27:03 2017 +0900

Add packet number encoder and decoder
---
 iocore/net/quic/QUICPacket.cc   | 54 +
 iocore/net/quic/QUICPacket.h|  4 +++
 iocore/net/quic/test/test_QUICPacket.cc | 39 
 3 files changed, 97 insertions(+)

diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 683fd48..d009249 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -594,6 +594,57 @@ QUICPacket::set_protected_payload(ats_unique_buf 
cipher_txt, size_t cipher_txt_l
   this->_protected_payload_size = cipher_txt_len;
 }
 
+uint8_t
+QUICPacket::calc_packet_number_len(QUICPacketNumber num, QUICPacketNumber base)
+{
+  ink_assert(num > base);
+
+  uint64_t d  = (num - base) * 2;
+  uint8_t len = 0;
+
+  if (d > 0x) {
+len = 4;
+  } else if (d > 0xFF) {
+len = 2;
+  } else {
+len = 1;
+  }
+
+  return len;
+}
+
+bool
+QUICPacket::encode_packet_number(QUICPacketNumber , QUICPacketNumber src, 
size_t len)
+{
+  ink_assert(len == 1 || len == 2 || len == 4);
+
+  uint64_t mask = (1ULL << (len * 8)) - 1;
+  dst   = src & mask;
+  return true;
+}
+
+bool
+QUICPacket::decode_packet_number(QUICPacketNumber , QUICPacketNumber src, 
size_t len, QUICPacketNumber base)
+{
+  ink_assert(len == 1 || len == 2 || len == 4);
+
+  QUICPacketNumber expected = base + 1;
+
+  uint64_t p  = 1ULL << (len * 8);
+  QUICPacketNumber masked = base & (~(p - 1));
+  dst = masked + src;
+
+  if (dst >= expected) {
+return true;
+  }
+
+  dst += p;
+  return true;
+}
+
+//
+// QUICPacketFactory
+//
 std::unique_ptr
 QUICPacketFactory::create(IOBufferBlock *block)
 {
@@ -687,6 +738,9 @@ QUICPacketFactory::set_crypto_module(QUICCrypto *crypto)
   this->_crypto = crypto;
 }
 
+//
+// QUICPacketNumberGenerator
+//
 QUICPacketNumber
 QUICPacketNumberGenerator::next()
 {
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 224f7e6..02ecf66 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -147,6 +147,10 @@ public:
   void store_header(uint8_t *buf, size_t *len) const;
   bool has_valid_fnv1a_hash() const;
   QUICKeyPhase key_phase() const;
+  static uint8_t calc_packet_number_len(QUICPacketNumber num, QUICPacketNumber 
base);
+  static bool encode_packet_number(QUICPacketNumber , QUICPacketNumber 
src, size_t len);
+  static bool decode_packet_number(QUICPacketNumber , QUICPacketNumber 
src, size_t len, QUICPacketNumber largest_acked_num);
+
   LINK(QUICPacket, link);
 
 private:
diff --git a/iocore/net/quic/test/test_QUICPacket.cc 
b/iocore/net/quic/test/test_QUICPacket.cc
index 1dc3b70..82a6632 100644
--- a/iocore/net/quic/test/test_QUICPacket.cc
+++ b/iocore/net/quic/test/test_QUICPacket.cc
@@ -94,3 +94,42 @@ TEST_CASE("Loading Unknown Packet", "[quic]")
 
   CHECK(header->type() == QUICPacketType::UNINITIALIZED);
 }
+
+TEST_CASE("Encoded Packet Number Length", "[quic]")
+{
+  QUICPacketNumber base = 0x6afa2f;
+
+  CHECK(QUICPacket::calc_packet_number_len(0x6b4264, base) == 2);
+  CHECK(QUICPacket::calc_packet_number_len(0x6bc107, base) == 4);
+}
+
+TEST_CASE("Encoding Packet Number", "[quic]")
+{
+  QUICPacketNumber dst = 0;
+  QUICPacketNumber src = 0xaa831f94;
+
+  QUICPacket::encode_packet_number(dst, src, 2);
+  CHECK(dst == 0x1f94);
+}
+
+TEST_CASE("Decoding Packet Number 1", "[quic]")
+{
+  QUICPacketNumber dst  = 0;
+  QUICPacketNumber src  = 0x1f94;
+  size_t len= 2;
+  QUICPacketNumber base = 0xaa82f30e;
+
+  QUICPacket::decode_packet_number(dst, src, len, base);
+  CHECK(dst == 0xaa831f94);
+}
+
+TEST_CASE("Decoding Packet Number 2", "[quic]")
+{
+  QUICPacketNumber dst  = 0;
+  QUICPacketNumber src  = 0xf1;
+  size_t len= 1;
+  QUICPacketNumber base = 0x18bf54f0;
+
+  QUICPacket::decode_packet_number(dst, src, len, base);
+  CHECK(dst == 0x18bf54f1);
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" '].