[2/2] trafficserver git commit: TS-4063: Add regression tests for HPACK Huffman

2015-12-09 Thread masaori
TS-4063: Add regression tests for HPACK Huffman

This closes #372


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d5307c6d
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d5307c6d
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d5307c6d

Branch: refs/heads/master
Commit: d5307c6d5b7d1414550f4d618e69a4161d1f147e
Parents: 9894fb1 c98b51f
Author: Masakazu Kitajo <mkita...@yahoo-corp.jp>
Authored: Thu Dec 10 10:02:45 2015 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Thu Dec 10 10:08:10 2015 +0900

--
 proxy/http2/RegressionHPACK.cc | 84 +++--
 1 file changed, 72 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d5307c6d/proxy/http2/RegressionHPACK.cc
--
diff --cc proxy/http2/RegressionHPACK.cc
index f4e8da8,c1021d0..5ceebc8
--- a/proxy/http2/RegressionHPACK.cc
+++ b/proxy/http2/RegressionHPACK.cc
@@@ -110,19 -110,60 +110,65 @@@ const static struct 
{(char *)"password", (char *) "secret", 0, HPACK_FIELD_NEVERINDEX_LITERAL, 
(uint8_t *) "\x10\x08"

   "password\x06"

   "secret",
-17}};
+17},
+   // with Huffman Coding
 -  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_INDEXED_LITERAL, (uint8_t *) "\x40"
 -  
 "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
 -  
 "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
++  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_INDEXED_LITERAL,
++   (uint8_t *) "\x40"
++   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
++   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+20},
 -  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NOINDEX_LITERAL, (uint8_t *) "\x00"
 -  
 "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
 -  
 "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
++  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NOINDEX_LITERAL,
++   (uint8_t *) "\x00"
++   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
++   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+20},
 -  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x10"
 -  
"\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
 -  
"\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
++  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NEVERINDEX_LITERAL,
++   (uint8_t *) "\x10"
++   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
++   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+20},
+   {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_INDEXED_LITERAL, 
(uint8_t *) "\x44"
+   
   "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+11},
+   {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_NOINDEX_LITERAL, 
(uint8_t *) "\x04"
+   
   "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+11},
 -  {(char *)":path", (char *) "/sample/path", 4, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x14"
 -  
  "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
++  {(char *)":path", (char *) "/sample/path", 4, 
HPACK_FIELD_NEVERINDEX_LITERAL,
++   (uint8_t *) "\x14"
++   "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+11},
+   {(char *)"password&quo

[1/2] trafficserver git commit: TS-4063: Add regression tests for HPACK Huffman

2015-12-09 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 9894fb1e4 -> d5307c6d5


TS-4063: Add regression tests for HPACK Huffman


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c98b51f9
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c98b51f9
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c98b51f9

Branch: refs/heads/master
Commit: c98b51f9985dfd678e80fa5cd484c53534cc2de9
Parents: 3ba9af9
Author: Masakazu Kitajo 
Authored: Wed Dec 9 16:42:42 2015 +0900
Committer: Masakazu Kitajo 
Committed: Wed Dec 9 16:42:42 2015 +0900

--
 proxy/http2/RegressionHPACK.cc | 68 +
 1 file changed, 62 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c98b51f9/proxy/http2/RegressionHPACK.cc
--
diff --git a/proxy/http2/RegressionHPACK.cc b/proxy/http2/RegressionHPACK.cc
index f4e8da8..c1021d0 100644
--- a/proxy/http2/RegressionHPACK.cc
+++ b/proxy/http2/RegressionHPACK.cc
@@ -110,9 +110,44 @@ const static struct {
   {(char *)"password", (char *) "secret", 0, HPACK_FIELD_NEVERINDEX_LITERAL, 
(uint8_t *) "\x10\x08"

  "password\x06"

  "secret",
-   17}};
+   17},
+  // with Huffman Coding
+  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_INDEXED_LITERAL, (uint8_t *) "\x40"
+   
"\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
+   
"\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+   20},
+  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NOINDEX_LITERAL, (uint8_t *) "\x00"
+   
"\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
+   
"\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+   20},
+  {(char *)"custom-key", (char *) "custom-header", 0, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x10"
+   
   "\x88\x25\xa8\x49\xe9\x5b\xa9\x7d\x7f"
+   
   "\x89\x25\xa8\x49\xe9\x5a\x72\x8e\x42\xd9",
+   20},
+  {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_INDEXED_LITERAL, 
(uint8_t *) "\x44"
+   
  "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+   11},
+  {(char *)":path", (char *) "/sample/path", 4, HPACK_FIELD_NOINDEX_LITERAL, 
(uint8_t *) "\x04"
+   
  "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+   11},
+  {(char *)":path", (char *) "/sample/path", 4, 
HPACK_FIELD_NEVERINDEX_LITERAL, (uint8_t *) "\x14"
+   
 "\x89\x61\x03\xa6\xba\x0a\xc5\x63\x4c\xff",
+   11},
+  {(char *)"password", (char *) "secret", 0, HPACK_FIELD_INDEXED_LITERAL, 
(uint8_t *) "\x40"
+   
   "\x86\xac\x68\x47\x83\xd9\x27"
+   
   "\x84\x41\x49\x61\x53",
+   13},
+  {(char *)"password", (char *) "secret", 0, HPACK_FIELD_NOINDEX_LITERAL, 
(uint8_t *) "\x00"
+   
   "\x86\xac\x68\x47\x83\xd9\x27"
+   
   "\x84\x41\x49\x61\x53",
+   13},
+  {(char *)"password", (char *) "secret", 0, HPACK_FIELD_NEVERINDEX_LITERAL, 
(uint8_t *) "\x10"
+   
  "\x86\xac\x68\x47\x83\xd9\x27"
+   
  "\x84\x41\x49\x61\x53",
+   13}};
 
 // [RFC 7541] C.3. Request Examples without Huffman Coding - C.3.1. First 
Request
+// [RFC 7541] C.4. Request Examples with Huffman Coding - C.4.1. First Request
 const static struct {
   char *raw_name;
   char *raw_value;
@@ -122,6 +157,12 @@ const static struct {
   {(char *)":path", (char *) "/"},
   {(char *)":authority", (char *) 

[2/2] trafficserver git commit: TS-4062: CID 1341763: Free data when error

2015-12-09 Thread masaori
TS-4062: CID 1341763: Free data when error

This closes #370


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/88c35d77
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/88c35d77
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/88c35d77

Branch: refs/heads/master
Commit: 88c35d77a8897325f0cecfc4c844938bbffa6035
Parents: a68d583
Author: Masaori Koshiba <masa...@apache.org>
Authored: Wed Dec 9 11:29:20 2015 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Thu Dec 10 10:35:23 2015 +0900

--
 proxy/http2/HPACK.cc | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/88c35d77/proxy/http2/HPACK.cc
--
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index 7e4b2fc..51b9a2f 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -347,14 +347,26 @@ encode_string(uint8_t *buf_start, const uint8_t *buf_end, 
const char *value, siz
 
   // Length
   const int64_t len = encode_integer(p, buf_end, data_len, 7);
-  if (len == -1)
+  if (len == -1) {
+if (use_huffman) {
+  ats_free(data);
+}
+
 return -1;
+  }
+
   if (use_huffman) {
 *p |= 0x80;
   }
   p += len;
-  if (buf_end < p || buf_end - p < data_len)
+
+  if (buf_end < p || buf_end - p < data_len) {
+if (use_huffman) {
+  ats_free(data);
+}
+
 return -1;
+  }
 
   // Value
   memcpy(p, data, data_len);



[2/2] trafficserver git commit: TS-3478: clang-format

2016-01-09 Thread masaori
TS-3478: clang-format


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/770e7878
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/770e7878
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/770e7878

Branch: refs/heads/master
Commit: 770e7878c0f4dde9516f6f93490eb8b2f66a8dd2
Parents: 82ce756
Author: Masaori Koshiba <masa...@apache.org>
Authored: Sat Jan 9 18:04:59 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Sat Jan 9 18:04:59 2016 +0900

--
 proxy/http2/HPACK.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/770e7878/proxy/http2/HPACK.h
--
diff --git a/proxy/http2/HPACK.h b/proxy/http2/HPACK.h
index 2cda962..14430da 100644
--- a/proxy/http2/HPACK.h
+++ b/proxy/http2/HPACK.h
@@ -122,7 +122,7 @@ public:
 delete _mhdr;
   }
 
-  const MIMEField * get_header_field(uint32_t index) const;
+  const MIMEField *get_header_field(uint32_t index) const;
   void add_header_field(const MIMEField *field);
 
   uint32_t get_size() const;
@@ -175,7 +175,7 @@ int64_t encode_indexed_header_field(uint8_t *buf_start, 
const uint8_t *buf_end,
 int64_t encode_literal_header_field_with_indexed_name(uint8_t *buf_start, 
const uint8_t *buf_end, const MIMEFieldWrapper ,
   uint32_t index, 
Http2IndexingTable _table, HpackFieldType type);
 int64_t encode_literal_header_field_with_new_name(uint8_t *buf_start, const 
uint8_t *buf_end, const MIMEFieldWrapper ,
-Http2IndexingTable _table, HpackFieldType type);
+  Http2IndexingTable 
_table, HpackFieldType type);
 
 // When these functions returns minus value, any error occurs
 // TODO Separate error code and length of processed buffer



[1/2] trafficserver git commit: TS-3478: Indexing header representations on HPACK encoder

2016-01-09 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 442511397 -> 770e7878c


TS-3478: Indexing header representations on HPACK encoder

This closes #391


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/82ce7567
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/82ce7567
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/82ce7567

Branch: refs/heads/master
Commit: 82ce75676f2ad614be20793b4a217308e6981e84
Parents: 4425113
Author: Ryo Okubo <rok...@yahoo-corp.jp>
Authored: Sun Dec 13 23:42:55 2015 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Sat Jan 9 18:03:38 2016 +0900

--
 proxy/http2/HPACK.cc| 183 +-
 proxy/http2/HPACK.h |  60 +---
 proxy/http2/HTTP2.cc|  46 +-
 proxy/http2/HTTP2.h |   6 +-
 proxy/http2/Http2ConnectionState.cc |   8 +-
 proxy/http2/Http2ConnectionState.h  |  12 +-
 proxy/http2/Http2Stream.h   |   4 +-
 proxy/http2/RegressionHPACK.cc  | 254 ++-
 8 files changed, 423 insertions(+), 150 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/82ce7567/proxy/http2/HPACK.cc
--
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index b54d923..3254aa5 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -174,18 +174,62 @@ const static struct {
 {"via", ""},
 {"www-authenticate", ""}};
 
+Http2LookupIndexResult
+Http2IndexingTable::get_index(const MIMEFieldWrapper ) const
+{
+  Http2LookupIndexResult result;
+  int target_name_len = 0, target_value_len = 0;
+  const char *target_name = field.name_get(_name_len);
+  const char *target_value = field.value_get(_value_len);
+  const int entry_num = TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
_dynamic_table.get_current_entry_num();
+
+  for (int index = 1; index < entry_num; ++index) {
+const char *table_name, *table_value;
+int table_name_len = 0, table_value_len = 0;
+
+if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM) {
+  // static table
+  table_name = STATIC_TABLE[index].name;
+  table_value = STATIC_TABLE[index].value;
+  table_name_len = strlen(table_name);
+  table_value_len = strlen(table_value);
+} else {
+  // dynamic table
+  const MIMEField *m_field = _dynamic_table.get_header_field(index - 
TS_HPACK_STATIC_TABLE_ENTRY_NUM);
+
+  table_name = m_field->name_get(_name_len);
+  table_value = m_field->value_get(_value_len);
+}
+
+// Check whether name (and value) are matched
+if (ptr_len_casecmp(target_name, target_name_len, table_name, 
table_name_len) == 0) {
+  if (ptr_len_cmp(target_value, target_value_len, table_value, 
table_value_len) == 0) {
+result.index = index;
+result.value_is_indexed = true;
+break;
+  } else if (!result.index) {
+result.index = index;
+  }
+}
+  }
+
+  return result;
+}
+
 int
-Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, 
MIMEFieldWrapper ) const
+Http2IndexingTable::get_header_field(uint32_t index, MIMEFieldWrapper ) 
const
 {
   // Index Address Space starts at 1, so index == 0 is invalid.
   if (!index)
 return HPACK_ERROR_COMPRESSION_ERROR;
 
   if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM) {
+// static table
 field.name_set(STATIC_TABLE[index].name, strlen(STATIC_TABLE[index].name));
 field.value_set(STATIC_TABLE[index].value, 
strlen(STATIC_TABLE[index].value));
-  } else if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
get_current_entry_num()) {
-const MIMEField *m_field = get_header(index - 
TS_HPACK_STATIC_TABLE_ENTRY_NUM + 1);
+  } else if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM + 
_dynamic_table.get_current_entry_num()) {
+// dynamic table
+const MIMEField *m_field = _dynamic_table.get_header_field(index - 
TS_HPACK_STATIC_TABLE_ENTRY_NUM);
 
 int name_len, value_len;
 const char *name = m_field->name_get(_len);
@@ -203,33 +247,34 @@ 
Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, MIMEFieldWrap
   return 0;
 }
 
-//
-// [RFC 7541] 4.3. Entry Eviction when Header Table Size Changes
-//
-// Whenever the maximum size for the header table is reduced, entries
-// are evicted from the end of the header table until the size of the
-// header table is less than or equal to the maximum size.
-//
-bool
-Http2DynamicTable::set_dynamic_table_size(uint32_t new_size)
+void
+Http2IndexingTable::add_header_field_to_dynamic_table(const MIMEField *field)
 {
-  while (_current_size > new_size) {
-if (_he

trafficserver git commit: TS-3986: Cleanup code related to HTTP/2 frame flags validation

2015-12-01 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master cb8382a64 -> f8621492a


TS-3986: Cleanup code related to HTTP/2 frame flags validation

1. Rename http2_are_frame_flags_valid to http2_frame_flags_are_valid
2. Move list of masks to HTTP2.h from HTTP2.cc

This closes #354


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f8621492
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f8621492
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f8621492

Branch: refs/heads/master
Commit: f8621492a725db05f5e5f87998f4f90dc7a59941
Parents: cb8382a
Author: Masaori Koshiba <masa...@apache.org>
Authored: Tue Dec 1 18:51:07 2015 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Tue Dec 1 18:51:07 2015 +0900

--
 proxy/http2/HTTP2.cc | 14 --
 proxy/http2/HTTP2.h  |  6 ++
 2 files changed, 10 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8621492/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 195b9e1..a9b0e2b 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -105,27 +105,21 @@ memcpy_and_advance(uint8_t(), byte_pointer )
 }
 
 static bool
-http2_are_frame_flags_valid(uint8_t ftype, uint8_t fflags)
+http2_frame_flags_are_valid(uint8_t ftype, uint8_t fflags)
 {
-  static const uint8_t mask[HTTP2_FRAME_TYPE_MAX] = {
-HTTP2_FLAGS_DATA_MASK,  HTTP2_FLAGS_HEADERS_MASK,  
HTTP2_FLAGS_PRIORITY_MASK, HTTP2_FLAGS_RST_STREAM_MASK,
-HTTP2_FLAGS_SETTINGS_MASK,  HTTP2_FLAGS_PUSH_PROMISE_MASK, 
HTTP2_FLAGS_PING_MASK, HTTP2_FLAGS_GOAWAY_MASK,
-HTTP2_FLAGS_WINDOW_UPDATE_MASK, HTTP2_FLAGS_CONTINUATION_MASK,
-  };
-
   if (ftype >= HTTP2_FRAME_TYPE_MAX) {
 // Skip validation for Unkown frame type - [RFC 7540] 5.5. Extending HTTP/2
 return true;
   }
 
   // The frame flags are valid for this frame if nothing outside the defined 
bits is set.
-  return (fflags & ~mask[ftype]) == 0;
+  return (fflags & ~HTTP2_FRAME_FLAGS_MASKS[ftype]) == 0;
 }
 
 bool
 http2_frame_header_is_valid(const Http2FrameHeader , unsigned 
max_frame_size)
 {
-  if (!http2_are_frame_flags_valid(hdr.type, hdr.flags)) {
+  if (!http2_frame_flags_are_valid(hdr.type, hdr.flags)) {
 return false;
   }
 
@@ -869,7 +863,7 @@ REGRESSION_TEST(HTTP2_FRAME_FLAGS)(RegressionTest *t, int, 
int *pstatus)
   box = REGRESSION_TEST_PASSED;
 
   for (unsigned int i = 0; i < sizeof(http2_frame_flags_test_case) / 
sizeof(http2_frame_flags_test_case[0]); ++i) {
-
box.check(http2_are_frame_flags_valid(http2_frame_flags_test_case[i].ftype, 
http2_frame_flags_test_case[i].fflags) ==
+
box.check(http2_frame_flags_are_valid(http2_frame_flags_test_case[i].ftype, 
http2_frame_flags_test_case[i].fflags) ==
 http2_frame_flags_test_case[i].valid,
   "Validation of frame flags (type: %d, flags: %d) are expected 
%d, but not", http2_frame_flags_test_case[i].ftype,
   http2_frame_flags_test_case[i].fflags, 
http2_frame_flags_test_case[i].valid);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f8621492/proxy/http2/HTTP2.h
--
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 9120d7c..ba322db 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -201,6 +201,12 @@ enum Http2FrameFlagsContinuation {
   HTTP2_FLAGS_CONTINUATION_MASK = 0x04,
 };
 
+static const uint8_t HTTP2_FRAME_FLAGS_MASKS[HTTP2_FRAME_TYPE_MAX] = {
+  HTTP2_FLAGS_DATA_MASK,  HTTP2_FLAGS_HEADERS_MASK,  
HTTP2_FLAGS_PRIORITY_MASK, HTTP2_FLAGS_RST_STREAM_MASK,
+  HTTP2_FLAGS_SETTINGS_MASK,  HTTP2_FLAGS_PUSH_PROMISE_MASK, 
HTTP2_FLAGS_PING_MASK, HTTP2_FLAGS_GOAWAY_MASK,
+  HTTP2_FLAGS_WINDOW_UPDATE_MASK, HTTP2_FLAGS_CONTINUATION_MASK,
+};
+
 // [RFC 7540] 6.5.2. Defined SETTINGS Parameters
 enum Http2SettingsIdentifier {
   HTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,



trafficserver git commit: Doc: [TS-4123] Fix image URLs in the Security page

2016-01-11 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 8df989ce6 -> 4c65b7775


Doc: [TS-4123] Fix image URLs in the Security page

This closes #415


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4c65b777
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4c65b777
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4c65b777

Branch: refs/heads/master
Commit: 4c65b77759ad0ec3f7ad4b8fdc8ac6b163e6443d
Parents: 8df989c
Author: Hiroaki Nakamura <hnaka...@gmail.com>
Authored: Mon Jan 11 16:47:58 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Mon Jan 11 17:30:17 2016 +0900

--
 doc/admin-guide/security/index.en.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4c65b777/doc/admin-guide/security/index.en.rst
--
diff --git a/doc/admin-guide/security/index.en.rst 
b/doc/admin-guide/security/index.en.rst
index 3a14747..22365d8 100644
--- a/doc/admin-guide/security/index.en.rst
+++ b/doc/admin-guide/security/index.en.rst
@@ -69,7 +69,7 @@ Server (and between Traffic Server and an origin server) when 
the SSL
 termination option is enabled and configured for Client/Traffic
 Server connections only.
 
-.. figure:: ../static/images/admin/ssl_c.jpg
+.. figure:: ../../static/images/admin/ssl_c.jpg
:align: center
:alt: Client and Traffic Server communication using SSL termination
 
@@ -163,7 +163,7 @@ The figure below illustrates communication between Traffic 
Server and an
 origin server when the SSL termination option is enabled for Traffic
 Server/origin server connections.
 
-.. figure:: ../static/images/admin/ssl_os.jpg
+.. figure:: ../../static/images/admin/ssl_os.jpg
:align: center
:alt: Traffic Server and origin server communication using SSL termination
 



[trafficserver] branch master updated (fd834d7 -> aac5a52)

2016-06-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  fd834d7   TS-4511: ATS crashes when no_dns_just_forward is 
configured without parent proxies (#698)
  adds  30a1eed   TS-4496: Remove ink_code_md5_stringify and unused code
   new  aac5a52   Merge pull request #686 from masaori335/ts-4496

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lib/ts/ink_code.cc | 27 ---
 lib/ts/ink_code.h  |  1 -
 mgmt/WebMgmtUtils.cc   | 12 
 mgmt/WebMgmtUtils.h|  2 --
 mgmt/api/INKMgmtAPI.cc | 27 ---
 mgmt/api/include/mgmtapi.h |  7 ---
 6 files changed, 76 deletions(-)

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


[trafficserver] 01/01: Merge pull request #686 from masaori335/ts-4496

2016-06-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit aac5a52b47a9db11cf4681c3496e6ab7c5aec40c
Merge: fd834d7 30a1eed
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Jun 8 00:55:37 2016 -0700

Merge pull request #686 from masaori335/ts-4496

TS-4496: Remove ink_code_md5_stringify

 lib/ts/ink_code.cc | 27 ---
 lib/ts/ink_code.h  |  1 -
 mgmt/WebMgmtUtils.cc   | 12 
 mgmt/WebMgmtUtils.h|  2 --
 mgmt/api/INKMgmtAPI.cc | 27 ---
 mgmt/api/include/mgmtapi.h |  7 ---
 6 files changed, 76 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (1385f52 -> b1d1b69)

2016-06-01 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  1385f52   Merge pull request #683 from shinrich/ts-4309-3
  adds  f1642f0   TS-4489: Remove second calling of 
Http2ConnectionState::delete_stream in Http2Stream::do_io_close
   new  b1d1b69   Merge pull request #682 from masaori335/ts-4489

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http2/Http2Stream.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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


[trafficserver] 01/01: Merge pull request #684 from masaori335/ts-4494

2016-06-01 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 3f9fd4eca7c85a70b07c20aca9afb171659341ce
Merge: b1d1b69 506153a
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Jun 1 11:22:05 2016 -0700

Merge pull request #684 from masaori335/ts-4494

TS-4494: Replace ink_code_md5_stringify to ink_code_to_hex_str

 proxy/http/HttpConnectionCount.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (b1d1b69 -> 3f9fd4e)

2016-06-01 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  b1d1b69   Merge pull request #682 from masaori335/ts-4489
  adds  506153a   TS-4494: Replace ink_code_md5_stringify to 
ink_code_to_hex_str
   new  3f9fd4e   Merge pull request #684 from masaori335/ts-4494

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http/HttpConnectionCount.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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


trafficserver git commit: TS-4162: Add proxy.config.http2.active_timeout_in

2016-02-01 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 64b9e67b6 -> 2aae7251b


TS-4162: Add proxy.config.http2.active_timeout_in

Current default value is 0 for compatibility with existing 6.x code.
This is going to be changed by TS-4167 in 7.0.0.

This closes #444


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2aae7251
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2aae7251
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2aae7251

Branch: refs/heads/master
Commit: 2aae7251b793c9db3cb3ddd71f666e872522732f
Parents: 64b9e67
Author: Masaori Koshiba <masa...@apache.org>
Authored: Fri Jan 29 18:35:55 2016 +0900
Committer: Masaori Koshiba <mkosh...@yahoo-corp.jp>
Committed: Tue Feb 2 10:30:52 2016 +0900

--
 mgmt/RecordsConfig.cc | 2 ++
 proxy/http2/HTTP2.cc  | 2 ++
 proxy/http2/HTTP2.h   | 1 +
 proxy/http2/Http2ClientSession.cc | 1 +
 4 files changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/mgmt/RecordsConfig.cc
--
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 9eea1b3..553476e 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1995,6 +1995,8 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http2.no_activity_timeout_in", RECD_INT, "115", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http2.active_timeout_in", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
 
   //# Add LOCAL Records Here
   {RECT_LOCAL, "proxy.local.incoming_ip_to_bind", RECD_STRING, NULL, 
RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 4f1fb4b..5cb9d79 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -735,6 +735,7 @@ uint32_t Http2::max_header_list_size = 4294967295;
 uint32_t Http2::max_request_header_size = 131072;
 uint32_t Http2::accept_no_activity_timeout = 120;
 uint32_t Http2::no_activity_timeout_in = 115;
+uint32_t Http2::active_timeout_in = 0;
 
 void
 Http2::init()
@@ -747,6 +748,7 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(max_request_header_size, 
"proxy.config.http.request_header_max_size");
   REC_EstablishStaticConfigInt32U(accept_no_activity_timeout, 
"proxy.config.http2.accept_no_activity_timeout");
   REC_EstablishStaticConfigInt32U(no_activity_timeout_in, 
"proxy.config.http2.no_activity_timeout_in");
+  REC_EstablishStaticConfigInt32U(active_timeout_in, 
"proxy.config.http2.active_timeout_in");
 
   // If any settings is broken, ATS should not start
   
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams}) &&

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/proxy/http2/HTTP2.h
--
diff --git a/proxy/http2/HTTP2.h b/proxy/http2/HTTP2.h
index 814b42e..ebac76f 100644
--- a/proxy/http2/HTTP2.h
+++ b/proxy/http2/HTTP2.h
@@ -350,6 +350,7 @@ public:
   static uint32_t max_request_header_size;
   static uint32_t accept_no_activity_timeout;
   static uint32_t no_activity_timeout_in;
+  static uint32_t active_timeout_in;
 
   static void init();
 };

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2aae7251/proxy/http2/Http2ClientSession.cc
--
diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index ccad11f..4750111 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -295,6 +295,7 @@ Http2ClientSession::state_read_connection_preface(int 
event, void *edata)
 HTTP2_SET_SESSION_HANDLER(::state_start_frame_read);
 
 
client_vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::no_activity_timeout_in));
+client_vc->set_active_timeout(HRTIME_SECONDS(Http2::active_timeout_in));
 
 // XXX start the write VIO ...
 



trafficserver git commit: TS-4144: Add TSHttpTxnSetHttpRetStatus wrapper in CPP API

2016-02-02 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 868efaf93 -> 60bcf3e26


TS-4144: Add TSHttpTxnSetHttpRetStatus wrapper in CPP API

This closes #435


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/60bcf3e2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/60bcf3e2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/60bcf3e2

Branch: refs/heads/master
Commit: 60bcf3e26f2ce4fed3cf04788425e18f64654a5b
Parents: 868efaf
Author: Yukihisa Ishimura <yishi...@yahoo-corp.jp>
Authored: Fri Jan 22 11:00:33 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Wed Feb 3 15:46:35 2016 +0900

--
 configure.ac|  1 +
 lib/atscppapi/examples/Makefile.am  |  3 +-
 .../CustomErrorRemapPlugin.cc   | 57 
 .../custom_error_remap_plugin/Makefile.am   | 25 +
 lib/atscppapi/src/Transaction.cc| 22 +++-
 .../src/include/atscppapi/Transaction.h | 20 +++
 6 files changed, 125 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60bcf3e2/configure.ac
--
diff --git a/configure.ac b/configure.ac
index 56793a1..58adee7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1958,6 +1958,7 @@ AS_IF([test "x$enable_cppapi" = "xyes"], [
   lib/atscppapi/examples/null_transformation_plugin/Makefile
   lib/atscppapi/examples/post_buffer/Makefile
   lib/atscppapi/examples/remap_plugin/Makefile
+  lib/atscppapi/examples/custom_error_remap_plugin/Makefile
   lib/atscppapi/examples/serverresponse/Makefile
   lib/atscppapi/examples/stat_example/Makefile
   lib/atscppapi/examples/timeout_example/Makefile

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60bcf3e2/lib/atscppapi/examples/Makefile.am
--
diff --git a/lib/atscppapi/examples/Makefile.am 
b/lib/atscppapi/examples/Makefile.am
index 9f56838..bcc3ba0 100644
--- a/lib/atscppapi/examples/Makefile.am
+++ b/lib/atscppapi/examples/Makefile.am
@@ -30,10 +30,11 @@ SUBDIRS = \
boom \
stat_example \
remap_plugin \
+   custom_error_remap_plugin \
async_http_fetch \
gzip_transformation \
timeout_example \
internal_transaction_handling \
async_timer \
intercept \
-async_http_fetch_streaming
+   async_http_fetch_streaming

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60bcf3e2/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc
--
diff --git 
a/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc 
b/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc
new file mode 100644
index 000..7d29b60
--- /dev/null
+++ b/lib/atscppapi/examples/custom_error_remap_plugin/CustomErrorRemapPlugin.cc
@@ -0,0 +1,57 @@
+/**
+  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.
+ */
+
+#include 
+#include 
+#include 
+
+using namespace std;
+using namespace atscppapi;
+
+class MyRemapPlugin : public RemapPlugin
+{
+public:
+  MyRemapPlugin(void **instance_handle) : RemapPlugin(instance_handle) {}
+
+  Result
+  doRemap(const Url _from_url, const Url _to_url, Transaction 
, bool )
+  {
+if (transaction.getClientRequest().getUrl().getQuery().find("custom=1") != 
string::npos) {
+  transaction.setStatusCode(HTTP_STATUS_FORBIDDEN);
+  if 
(transaction.getClientRequest().getUrl().getQuery().find("output=xml") != 
string::npos) {
+transaction.setErrorBody(
+  "Hello! This is a custom response without making an origin 
request and no server intercept.",
+  "application/xml");
+  } else {
+transaction.setErrorBody("Hello! This is a cu

[1/2] trafficserver git commit: TS-4172: Cleanup debug logs of Http2ConnectionState

2016-02-16 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 0aabfb0bf -> 50703613f


TS-4172: Cleanup debug logs of Http2ConnectionState


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/81cd48f0
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/81cd48f0
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/81cd48f0

Branch: refs/heads/master
Commit: 81cd48f072b800e13acc2db821e14f7f6a3ac90c
Parents: 0aabfb0
Author: Masaori Koshiba <masa...@apache.org>
Authored: Thu Feb 4 16:24:53 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Wed Feb 17 10:46:12 2016 +0900

--
 proxy/http2/Http2ConnectionState.cc | 114 +--
 proxy/http2/Http2DebugNames.cc  |  47 +
 proxy/http2/Http2DebugNames.h   |  35 ++
 proxy/http2/Makefile.am |   2 +
 4 files changed, 146 insertions(+), 52 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/81cd48f0/proxy/http2/Http2ConnectionState.cc
--
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 75744dc..4a5c0a4 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -25,8 +25,13 @@
 #include "Http2ConnectionState.h"
 #include "Http2ClientSession.h"
 #include "Http2Stream.h"
+#include "Http2DebugNames.h"
 
-#define DebugHttp2Ssn(fmt, ...) DebugSsn("http2_cs", "[%" PRId64 "] " fmt, 
this->con_id, __VA_ARGS__)
+#define DebugHttp2Con(ua_session, fmt, ...) \
+  DebugSsn(ua_session, "http2_con", "[%" PRId64 "] " fmt, 
ua_session->connection_id(), ##__VA_ARGS__);
+
+#define DebugHttp2Stream(ua_session, stream_id, fmt, ...) \
+  DebugSsn(ua_session, "http2_con", "[%" PRId64 "] [%u] " fmt, 
ua_session->connection_id(), stream_id, ##__VA_ARGS__);
 
 typedef Http2Error (*http2_frame_dispatch)(Http2ClientSession &, 
Http2ConnectionState &, const Http2Frame &);
 
@@ -59,7 +64,7 @@ read_rcv_buffer(char *buf, size_t bufsize, unsigned , 
const Http2Frame 
 }
 
 static Http2Error
-rcv_data_frame(Http2ClientSession , Http2ConnectionState , const 
Http2Frame )
+rcv_data_frame(Http2ClientSession & /* cs */, Http2ConnectionState , 
const Http2Frame )
 {
   char buf[BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_DATA])];
   unsigned nbytes = 0;
@@ -67,7 +72,7 @@ rcv_data_frame(Http2ClientSession , Http2ConnectionState 
, const Http2
   uint8_t pad_length = 0;
   const uint32_t payload_length = frame.header().length;
 
-  DebugSsn(, "http2_cs", "[%" PRId64 "] Received DATA frame.", 
cs.connection_id());
+  DebugHttp2Stream(cstate.ua_session, id, "Received DATA frame");
 
   // If a DATA frame is received whose stream identifier field is 0x0, the
   // recipient MUST
@@ -173,12 +178,12 @@ rcv_data_frame(Http2ClientSession , 
Http2ConnectionState , const Http2
  *  CONTINUATION frame
  */
 static Http2Error
-rcv_headers_frame(Http2ClientSession , Http2ConnectionState , const 
Http2Frame )
+rcv_headers_frame(Http2ClientSession & /* cs */, Http2ConnectionState , 
const Http2Frame )
 {
   const Http2StreamId stream_id = frame.header().streamid;
   const uint32_t payload_length = frame.header().length;
 
-  DebugSsn(, "http2_cs", "[%" PRId64 "] Received HEADERS frame.", 
cs.connection_id());
+  DebugHttp2Stream(cstate.ua_session, stream_id, "Received HEADERS frame");
 
   if (!http2_is_client_streamid(stream_id)) {
 return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, 
HTTP2_ERROR_PROTOCOL_ERROR);
@@ -288,8 +293,7 @@ rcv_headers_frame(Http2ClientSession , 
Http2ConnectionState , const Ht
   } else {
 // NOTE: Expect CONTINUATION Frame. Do NOT change state of stream or decode
 // Header Blocks.
-DebugSsn(, "http2_cs", "[%" PRId64 "] No END_HEADERS flag, expecting 
CONTINUATION frame.", cs.connection_id());
-
+DebugHttp2Stream(cstate.ua_session, stream_id, "No END_HEADERS flag, 
expecting CONTINUATION frame");
 cstate.set_continued_stream_id(stream_id);
   }
 
@@ -297,9 +301,9 @@ rcv_headers_frame(Http2ClientSession , 
Http2ConnectionState , const Ht
 }
 
 static Http2Error
-rcv_priority_frame(Http2ClientSession , Http2ConnectionState & /*cstate*/, 
const Http2Frame )
+rcv_priority_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
, const Http2Frame )
 {
-  DebugSsn(, "http2_cs", "[%" PRId64 "] received PRIORITY frame", 
cs.connection_id());
+  DebugH

[2/2] trafficserver git commit: TS-4172: Cleanup debug logs of Http2ClientSession

2016-02-16 Thread masaori
TS-4172: Cleanup debug logs of Http2ClientSession

This closes #454


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/50703613
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/50703613
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/50703613

Branch: refs/heads/master
Commit: 50703613fc4706480f5ac625d15d1dbe9c7f52e9
Parents: 81cd48f
Author: Masaori Koshiba <masa...@apache.org>
Authored: Wed Feb 10 16:19:18 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Wed Feb 17 10:51:09 2016 +0900

--
 proxy/http2/Http2ClientSession.cc | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/50703613/proxy/http2/Http2ClientSession.cc
--
diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 4750111..44f3249 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -31,9 +31,7 @@
  HttpDebugNames::get_event_name(event));   
  \
   } while (0)
 
-#define DebugHttp2Ssn(fmt, ...) DebugSsn(this, "http2_cs", "[%" PRId64 "] " 
fmt, this->connection_id(), __VA_ARGS__)
-
-#define DebugHttp2Ssn0(msg) DebugSsn(this, "http2_cs", "[%" PRId64 "] " msg, 
this->connection_id())
+#define DebugHttp2Ssn(fmt, ...) DebugSsn(this, "http2_cs", "[%" PRId64 "] " 
fmt, this->connection_id(), ##__VA_ARGS__)
 
 #define HTTP2_SET_SESSION_HANDLER(handler) \
   do { \
@@ -69,7 +67,7 @@ Http2ClientSession::Http2ClientSession()
 void
 Http2ClientSession::destroy()
 {
-  DebugHttp2Ssn0("session destroy");
+  DebugHttp2Ssn("session destroy");
 
   ink_release_assert(this->client_vc == NULL);
 
@@ -200,7 +198,7 @@ Http2ClientSession::do_io_shutdown(ShutdownHowTo_t howto)
 void
 Http2ClientSession::do_io_close(int alerrno)
 {
-  DebugHttp2Ssn0("session closed");
+  DebugHttp2Ssn("session closed");
 
   ink_assert(this->mutex->thread_holding == this_ethread());
   if (client_vc) {
@@ -285,12 +283,12 @@ Http2ClientSession::state_read_connection_preface(int 
event, void *edata)
 ink_release_assert(nbytes == HTTP2_CONNECTION_PREFACE_LEN);
 
 if (memcmp(HTTP2_CONNECTION_PREFACE, buf, nbytes) != 0) {
-  DebugHttp2Ssn0("invalid connection preface");
+  DebugHttp2Ssn("invalid connection preface");
   this->do_io_close();
   return 0;
 }
 
-DebugHttp2Ssn0("received connection preface");
+DebugHttp2Ssn("received connection preface");
 this->sm_reader->consume(nbytes);
 HTTP2_SET_SESSION_HANDLER(::state_start_frame_read);
 
@@ -326,11 +324,11 @@ Http2ClientSession::state_start_frame_read(int event, 
void *edata)
 uint8_t buf[HTTP2_FRAME_HEADER_LEN];
 unsigned nbytes;
 
-DebugHttp2Ssn0("receiving frame header");
+DebugHttp2Ssn("receiving frame header");
 nbytes = copy_from_buffer_reader(buf, this->sm_reader, sizeof(buf));
 
 if (!http2_parse_frame_header(make_iovec(buf), this->current_hdr)) {
-  DebugHttp2Ssn0("frame header parse failure");
+  DebugHttp2Ssn("frame header parse failure");
   this->do_io_close();
   return 0;
 }



trafficserver git commit: TS-4209: Limit concurrent streams correctly

2016-02-16 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 50703613f -> be14b5ced


TS-4209: Limit concurrent streams correctly

This closes #480


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/be14b5ce
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/be14b5ce
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/be14b5ce

Branch: refs/heads/master
Commit: be14b5ced3a47beaa6e8cd8cec86f70b00388f5a
Parents: 5070361
Author: Masaori Koshiba <masa...@apache.org>
Authored: Tue Feb 16 10:48:19 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Wed Feb 17 10:54:40 2016 +0900

--
 proxy/http2/Http2ConnectionState.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/be14b5ce/proxy/http2/Http2ConnectionState.cc
--
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 4a5c0a4..c578e25 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -829,7 +829,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id)
   // Endpoints MUST NOT exceed the limit set by their peer.  An endpoint
   // that receives a HEADERS frame that causes their advertised concurrent
   // stream limit to be exceeded MUST treat this as a stream error.
-  if (client_streams_count >= 
client_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
+  if (client_streams_count >= 
server_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS)) {
 return NULL;
   }
 



trafficserver git commit: TS-4213: Remove unused arguments from frame_handlers

2016-02-21 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 86c5727ee -> e90a72374


TS-4213: Remove unused arguments from frame_handlers

This closes #484.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e90a7237
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e90a7237
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e90a7237

Branch: refs/heads/master
Commit: e90a7237408bae634cffa34c4aa76f834feacc75
Parents: 86c5727
Author: Masaori Koshiba <masa...@apache.org>
Authored: Wed Feb 17 15:22:39 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Mon Feb 22 10:57:10 2016 +0900

--
 proxy/http2/Http2ConnectionState.cc | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e90a7237/proxy/http2/Http2ConnectionState.cc
--
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index c578e25..4d33830 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -33,7 +33,7 @@
 #define DebugHttp2Stream(ua_session, stream_id, fmt, ...) \
   DebugSsn(ua_session, "http2_con", "[%" PRId64 "] [%u] " fmt, 
ua_session->connection_id(), stream_id, ##__VA_ARGS__);
 
-typedef Http2Error (*http2_frame_dispatch)(Http2ClientSession &, 
Http2ConnectionState &, const Http2Frame &);
+typedef Http2Error (*http2_frame_dispatch)(Http2ConnectionState &, const 
Http2Frame &);
 
 static const int buffer_size_index[HTTP2_FRAME_TYPE_MAX] = {
   BUFFER_SIZE_INDEX_8K,  // HTTP2_FRAME_TYPE_DATA
@@ -64,7 +64,7 @@ read_rcv_buffer(char *buf, size_t bufsize, unsigned , 
const Http2Frame 
 }
 
 static Http2Error
-rcv_data_frame(Http2ClientSession & /* cs */, Http2ConnectionState , 
const Http2Frame )
+rcv_data_frame(Http2ConnectionState , const Http2Frame )
 {
   char buf[BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_DATA])];
   unsigned nbytes = 0;
@@ -178,7 +178,7 @@ rcv_data_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState , cons
  *  CONTINUATION frame
  */
 static Http2Error
-rcv_headers_frame(Http2ClientSession & /* cs */, Http2ConnectionState , 
const Http2Frame )
+rcv_headers_frame(Http2ConnectionState , const Http2Frame )
 {
   const Http2StreamId stream_id = frame.header().streamid;
   const uint32_t payload_length = frame.header().length;
@@ -301,7 +301,7 @@ rcv_headers_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState , c
 }
 
 static Http2Error
-rcv_priority_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
, const Http2Frame )
+rcv_priority_frame(Http2ConnectionState , const Http2Frame )
 {
   DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received 
PRIORITY frame");
 
@@ -324,7 +324,7 @@ rcv_priority_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState ,
 }
 
 static Http2Error
-rcv_rst_stream_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
, const Http2Frame )
+rcv_rst_stream_frame(Http2ConnectionState , const Http2Frame )
 {
   Http2RstStream rst_stream;
   char buf[HTTP2_RST_STREAM_LEN];
@@ -378,7 +378,7 @@ rcv_rst_stream_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState 
 }
 
 static Http2Error
-rcv_settings_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
, const Http2Frame )
+rcv_settings_frame(Http2ConnectionState , const Http2Frame )
 {
   Http2SettingsParameter param;
   char buf[HTTP2_SETTINGS_PARAMETER_LEN];
@@ -450,7 +450,7 @@ rcv_settings_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState ,
 }
 
 static Http2Error
-rcv_push_promise_frame(Http2ClientSession & /* cs */, Http2ConnectionState 
, const Http2Frame )
+rcv_push_promise_frame(Http2ConnectionState , const Http2Frame )
 {
   DebugHttp2Stream(cstate.ua_session, frame.header().streamid, "Received 
PUSH_PROMISE frame");
 
@@ -460,7 +460,7 @@ rcv_push_promise_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState 
 }
 
 static Http2Error
-rcv_ping_frame(Http2ClientSession & /* cs */, Http2ConnectionState , 
const Http2Frame )
+rcv_ping_frame(Http2ConnectionState , const Http2Frame )
 {
   uint8_t opaque_data[HTTP2_PING_LEN];
   const Http2StreamId stream_id = frame.header().streamid;
@@ -494,7 +494,7 @@ rcv_ping_frame(Http2ClientSession & /* cs */, 
Http2ConnectionState , cons
 }
 
 static Http2Error
-rcv_goaway_frame(Http2ClientSession & /* cs */, Http2ConnectionState , 
const Http2Frame )
+rcv_goaway_frame(Http2ConnectionState , const Http2Frame )
 {
   Http2Goaway goaway;
   char buf[HTTP2_GOAWAY_LEN];
@@ -527,7 +527,7 @@ rc

trafficserver git commit: TS-4295: Add Priority Queue in lib/ts/

2016-04-08 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master ea1691ba5 -> 5952dd78f


TS-4295: Add Priority Queue in lib/ts/

This closes #537.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5952dd78
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5952dd78
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5952dd78

Branch: refs/heads/master
Commit: 5952dd78fc607be8567d4e86ce184ea91bcce867
Parents: ea1691b
Author: Masaori Koshiba <masa...@apache.org>
Authored: Fri Apr 8 17:25:54 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Fri Apr 8 17:30:58 2016 +0900

--
 .gitignore   |   1 +
 lib/ts/Makefile.am   |   7 +-
 lib/ts/PriorityQueue.h   | 214 
 lib/ts/Regression.cc |   2 +-
 lib/ts/Regression.h  |   2 +-
 lib/ts/TestBox.h |   1 +
 lib/ts/test_PriorityQueue.cc | 285 ++
 7 files changed, 509 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5952dd78/.gitignore
--
diff --git a/.gitignore b/.gitignore
index 493d95c..bf65b4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,6 +77,7 @@ lib/ts/test_Map
 lib/ts/test_Vec
 lib/ts/test_geometry
 lib/ts/test_Regex
+lib/ts/test_PriorityQueue
 lib/ts/test_X509HostnameValidator
 lib/perl/lib/Apache/TS.pm
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5952dd78/lib/ts/Makefile.am
--
diff --git a/lib/ts/Makefile.am b/lib/ts/Makefile.am
index 8824fb9..71ae96e 100644
--- a/lib/ts/Makefile.am
+++ b/lib/ts/Makefile.am
@@ -21,7 +21,7 @@ library_includedir=$(includedir)/ts
 library_include_HEADERS = apidefs.h
 
 noinst_PROGRAMS = mkdfa CompileParseRules
-check_PROGRAMS = test_arena test_atomic test_freelist test_geometry test_List 
test_Map test_Regex test_Vec test_X509HostnameValidator
+check_PROGRAMS = test_arena test_atomic test_freelist test_geometry test_List 
test_Map test_Regex test_PriorityQueue test_Vec test_X509HostnameValidator
 TESTS = $(check_PROGRAMS)
 
 AM_CPPFLAGS = -I$(top_srcdir)/lib
@@ -84,6 +84,7 @@ libtsutil_la_SOURCES = \
   MatcherUtils.h \
   ParseRules.cc \
   ParseRules.h \
+  PriorityQueue.h \
   Ptr.h \
   RawHashTable.cc \
   RawHashTable.h \
@@ -216,6 +217,10 @@ test_Regex_SOURCES = test_Regex.cc
 test_Regex_LDADD = libtsutil.la @LIBTCL@ @LIBPCRE@
 test_Regex_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 
+test_PriorityQueue_SOURCES = test_PriorityQueue.cc
+test_PriorityQueue_LDADD = libtsutil.la @LIBTCL@ @LIBPCRE@
+test_PriorityQueue_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
+
 test_Vec_SOURCES = test_Vec.cc
 test_Vec_LDADD = libtsutil.la @LIBTCL@ @LIBPCRE@
 test_Vec_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5952dd78/lib/ts/PriorityQueue.h
--
diff --git a/lib/ts/PriorityQueue.h b/lib/ts/PriorityQueue.h
new file mode 100644
index 000..f7185af
--- /dev/null
+++ b/lib/ts/PriorityQueue.h
@@ -0,0 +1,214 @@
+/** @file
+
+  Priority Queue Implementation using Binary Heap.
+
+  @section license License
+
+  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.
+ */
+
+#ifndef __PRIORITY_QUEUE_H__
+#define __PRIORITY_QUEUE_H__
+
+#include "ts/ink_assert.h"
+#include "ts/Vec.h"
+
+template  struct PriorityQueueEntry {
+  PriorityQueueEntry(T n) : index(0), node(n) {}
+
+  uint32_t index;
+  T node;
+};
+
+template  struct PriorityQueueLess {
+  bool operator()(const T , const T ) { return *a < *b; }
+};
+
+template  > class PriorityQueue
+{
+public:
+  PriorityQueue() {}
+  ~PriorityQueue() {}
+
+  const bool empty();
+  PriorityQueueEntry *top();
+  void pop();
+  void push(PriorityQueueEntry *);
+  void update(PriorityQueueEntry

[trafficserver] 01/01: Merge pull request #540 from masaori335/ts-4087_doc

2016-04-10 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 58d7710b9bdfbd35eabc3545c8c501d933c40d34
Merge: cbd094c e7951c6
Author: Masaori Koshiba <masaori...@gmail.com>
AuthorDate: Mon Apr 11 12:02:05 2016 +0900

Merge pull request #540 from masaori335/ts-4087_doc

TS-4087: Docs: About new settings to limit streams

 doc/admin-guide/files/records.config.en.rst | 14 ++
 1 file changed, 14 insertions(+)


-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (cbd094c -> 58d7710)

2016-04-10 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  cbd094c   TS-4313: Fix a bug in MIME caused by improper type 
conversion
  adds  e7951c6   TS-4087: Docs: About new settings to limit streams
   new  58d7710   Merge pull request #540 from masaori335/ts-4087_doc

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 doc/admin-guide/files/records.config.en.rst | 14 ++
 1 file changed, 14 insertions(+)

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


trafficserver git commit: TS-4087: Reduce SETTINGS_MAX_CONCURRENT_STREAMS when too many streams

2016-03-21 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 1e9c9484c -> 0e6e5c151


TS-4087: Reduce SETTINGS_MAX_CONCURRENT_STREAMS when too many streams

Add below variables in records.config
- proxy.config.http2.min_concurrent_streams_in
- proxy.config.http2.max_active_streams_in

When connection wide active stream are larger than 
proxy.config.http2.max_active_streams_in,
SETTINGS_MAX_CONCURRENT_STREAMS is reduced to 
proxy.config.http2.min_concurrent_streams_in
in new connections.

If the value of proxy.config.http2.max_active_streams_in is 0, there is no 
limit.

This closes #485


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0e6e5c15
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0e6e5c15
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0e6e5c15

Branch: refs/heads/master
Commit: 0e6e5c151cde5f06c15e295f663a98b2b7d37a6d
Parents: 1e9c948
Author: Masaori Koshiba <masa...@apache.org>
Authored: Mon Feb 15 20:57:25 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Tue Mar 22 10:52:37 2016 +0900

--
 mgmt/RecordsConfig.cc   |  4 
 proxy/http2/HTTP2.cc| 12 ---
 proxy/http2/HTTP2.h |  5 -
 proxy/http2/Http2ConnectionState.cc | 35 
 proxy/http2/Http2ConnectionState.h  |  4 +++-
 5 files changed, 55 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0e6e5c15/mgmt/RecordsConfig.cc
--
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 0e963c9..b0e0e6a 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1977,6 +1977,10 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.http2.max_concurrent_streams_in", RECD_INT, 
"100", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.http2.min_concurrent_streams_in", RECD_INT, 
"10", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.http2.max_active_streams_in", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
+  ,
   {RECT_CONFIG, "proxy.config.http2.initial_window_size_in", RECD_INT, 
"1048576", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http2.max_frame_size", RECD_INT, "16384", 
RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0e6e5c15/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 5cb9d79..c9ea2bc 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -727,7 +727,10 @@ http2_decode_header_blocks(HTTPHdr *hdr, const uint8_t 
*buf_start, const uint8_t
 }
 
 // Initialize this subsystem with librecords configs (for now)
-uint32_t Http2::max_concurrent_streams = 100;
+uint32_t Http2::max_concurrent_streams_in = 100;
+uint32_t Http2::min_concurrent_streams_in = 10;
+uint32_t Http2::max_active_streams_in = 0;
+bool Http2::throttling = false;
 uint32_t Http2::initial_window_size = 1048576;
 uint32_t Http2::max_frame_size = 16384;
 uint32_t Http2::header_table_size = 4096;
@@ -740,7 +743,9 @@ uint32_t Http2::active_timeout_in = 0;
 void
 Http2::init()
 {
-  REC_EstablishStaticConfigInt32U(max_concurrent_streams, 
"proxy.config.http2.max_concurrent_streams_in");
+  REC_EstablishStaticConfigInt32U(max_concurrent_streams_in, 
"proxy.config.http2.max_concurrent_streams_in");
+  REC_EstablishStaticConfigInt32U(min_concurrent_streams_in, 
"proxy.config.http2.min_concurrent_streams_in");
+  REC_EstablishStaticConfigInt32U(max_active_streams_in, 
"proxy.config.http2.max_active_streams_in");
   REC_EstablishStaticConfigInt32U(initial_window_size, 
"proxy.config.http2.initial_window_size_in");
   REC_EstablishStaticConfigInt32U(max_frame_size, 
"proxy.config.http2.max_frame_size");
   REC_EstablishStaticConfigInt32U(header_table_size, 
"proxy.config.http2.header_table_size");
@@ -751,7 +756,8 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(active_timeout_in, 
"proxy.config.http2.active_timeout_in");
 
   // If any settings is broken, ATS should not start
-  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams}) &&
+  
ink_release_assert(http2_settings_parameter_is_valid({HTT

trafficserver git commit: TS-4298: Breakdown parameter checks in Http2::init()

2016-03-27 Thread masaori
Repository: trafficserver
Updated Branches:
  refs/heads/master 2a0a2e96f -> bd645d36d


TS-4298: Breakdown parameter checks in Http2::init()

This closes #539


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bd645d36
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bd645d36
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bd645d36

Branch: refs/heads/master
Commit: bd645d36d0544a294b34189f6b5f9b53e37bdcdd
Parents: 2a0a2e9
Author: Masaori Koshiba <masa...@apache.org>
Authored: Fri Mar 25 15:48:26 2016 +0900
Committer: Masaori Koshiba <masa...@apache.org>
Committed: Mon Mar 28 14:43:06 2016 +0900

--
 proxy/http2/HTTP2.cc | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bd645d36/proxy/http2/HTTP2.cc
--
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index c9ea2bc..3eac878 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -756,12 +756,12 @@ Http2::init()
   REC_EstablishStaticConfigInt32U(active_timeout_in, 
"proxy.config.http2.active_timeout_in");
 
   // If any settings is broken, ATS should not start
-  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams_in}) &&
- 
http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 
min_concurrent_streams_in}) &&
- 
http2_settings_parameter_is_valid({HTTP2_SETTINGS_INITIAL_WINDOW_SIZE, 
initial_window_size}) &&
- 
http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_FRAME_SIZE, 
max_frame_size}) &&
- 
http2_settings_parameter_is_valid({HTTP2_SETTINGS_HEADER_TABLE_SIZE, 
header_table_size}) &&
- 
http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, 
max_header_list_size}));
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 max_concurrent_streams_in}));
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
 min_concurrent_streams_in}));
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
 initial_window_size}));
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_FRAME_SIZE,
 max_frame_size}));
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_HEADER_TABLE_SIZE,
 header_table_size}));
+  
ink_release_assert(http2_settings_parameter_is_valid({HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
 max_header_list_size}));
 
   // Setup statistics
   http2_rsb = RecAllocateRawStatBlock(static_cast(HTTP2_N_STATS));



[trafficserver] branch master updated (2a1c399 -> 9ec0676)

2016-04-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  2a1c399   TS-4364: Address remnants from HTTP/2 refactoring.  This 
closes #584.
  adds  37f7c05   TS-4355: Change assert condition for TS-3612
   new  9ec0676   Merge pull request #600 from masaori335/ts-4355

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http/HttpTunnel.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


[trafficserver] 01/01: Merge pull request #600 from masaori335/ts-4355

2016-04-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 9ec0676c5ed067337b314f0b60069d514562fc65
Merge: 2a1c399 37f7c05
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Apr 27 11:08:23 2016 +0900

Merge pull request #600 from masaori335/ts-4355

TS-4355: Change assert condition for TS-3612

 proxy/http/HttpTunnel.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated: TS-3535: Experimental Support of HTTP/2 Stream Priority feature

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

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  16172a4   TS-3535: Experimental Support of HTTP/2 Stream Priority 
feature
16172a4 is described below

commit 16172a4e79865d1201a51e85aeb72df8b0609986
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Feb 12 16:07:10 2016 +0900

TS-3535: Experimental Support of HTTP/2 Stream Priority feature

- Add a option to enable this feature ( disabled in default ).
  `proxy.config.http2.stream_priority_enabled`
- Parse priority parameters of HEADERS and PRIORITY frame correctly.
- Add Http2DependencyTree and tests using `lib/ts/PriorityQueue.h`.
- Create a dependency tree when clients send HEADERS frame with priority 
parameters or PRIORITY frame.
- Separate `Http2ConnectionState::send_data_frame()` into 
`Http2ConnectionState::send_a_data_frame()`
  and `Http2ConnectionState::send_data_frames()`.
- Schedule DATA frames using the WFQ algorithm.

This closes #632
---
 .gitignore  |   1 +
 doc/admin-guide/files/records.config.en.rst |   5 +
 mgmt/RecordsConfig.cc   |   4 +-
 proxy/http2/HTTP2.cc|  12 +-
 proxy/http2/HTTP2.h |  16 +-
 proxy/http2/Http2ConnectionState.cc | 309 ++
 proxy/http2/Http2ConnectionState.h  |  22 +-
 proxy/http2/Http2DependencyTree.h   | 308 ++
 proxy/http2/Http2Stream.cc  |  21 +-
 proxy/http2/Http2Stream.h   |   7 +
 proxy/http2/Makefile.am |  15 +-
 proxy/http2/test_Http2DependencyTree.cc | 327 
 12 files changed, 940 insertions(+), 107 deletions(-)

diff --git a/.gitignore b/.gitignore
index 61ec27d..601dcec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,6 +87,7 @@ proxy/config/records.config.default
 proxy/config/storage.config.default
 proxy/hdrs/test_mime
 proxy/http2/test_Huffmancode
+proxy/http2/test_Http2DependencyTree
 
 plugins/header_rewrite/header_rewrite_test
 plugins/experimental/esi/*_test
diff --git a/doc/admin-guide/files/records.config.en.rst 
b/doc/admin-guide/files/records.config.en.rst
index bc4f9d2..b2e6442 100644
--- a/doc/admin-guide/files/records.config.en.rst
+++ b/doc/admin-guide/files/records.config.en.rst
@@ -3063,6 +3063,11 @@ HTTP/2 Configuration
that the sender is prepared to accept blocks. The default value, which is
the unsigned int maximum value in Traffic Server, implies unlimited size.
 
+.. ts:cv:: CONFIG proxy.config.http2.stream_priority_enabled INT 0
+   :reloadable:
+
+   Enable the experimental HTTP/2 Stream Priority feature.
+
 SPDY Configuration
 ==
 
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index b500027..8d3e54b 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -1974,7 +1974,9 @@ static const RecordElement RecordsConfig[] =
   //# HTTP/2 global configuration.
   //#
   //
-  {RECT_CONFIG, "proxy.config.http2.enabled", RECD_INT, "0", RECU_RESTART_TM, 
RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  {RECT_CONFIG, "proxy.config.http2.enabled", RECD_INT, "0", RECU_DYNAMIC, 
RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+  ,
+  {RECT_CONFIG, "proxy.config.http2.stream_priority_enabled", RECD_INT, "0", 
RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.http2.max_concurrent_streams_in", RECD_INT, 
"100", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[0-9]+$", RECA_NULL}
   ,
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index bcaad3b..4bee9ed 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -335,15 +335,19 @@ http2_parse_headers_parameter(IOVec iov, 
Http2HeadersParameter )
 }
 
 bool
-http2_parse_priority_parameter(IOVec iov, Http2Priority )
+http2_parse_priority_parameter(IOVec iov, Http2Priority )
 {
   byte_pointer ptr(iov.iov_base);
   byte_addressable_value dependency;
 
   memcpy_and_advance(dependency.bytes, ptr);
-  memcpy_and_advance(params.weight, ptr);
 
-  params.stream_dependency = ntohl(dependency.value);
+  priority.exclusive_flag = dependency.bytes[0] & 0x80;
+
+  dependency.bytes[0] &= 0x7f; // Clear the highest bit for exclusive flag
+  priority.stream_dependency = ntohl(dependency.value);
+
+  memcpy_and_advance(priority.weight, ptr);
 
   return true;
 }
@@ -666,6 +670,7 @@ uint32_t Http2::max_concurrent_streams_in = 100;
 uint32_t Http2::min_concurrent_streams_in = 10;
 uint32_t Http2::max_active_streams_in = 0;
 bool Http2::throttling = false;
+uint32_t Http2::stream_priority_enabled = 0;
 uint32_t Http2::initial_wind

[trafficserver] 01/01: Merge pull request #825 from masaori335/ts-4694

2016-07-26 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 4b3d9037053108bd2d412fde7d1211560a385091
Merge: 0024323 4a9c564
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Jul 26 19:18:14 2016 +0900

Merge pull request #825 from masaori335/ts-4694

TS-4694: Some refactoring after SPDY is removed

 proxy/ProxyClientSession.h  |  1 +
 proxy/ProxyClientTransaction.cc | 16 
 proxy/ProxyClientTransaction.h  |  6 +-
 proxy/http/Http1ClientSession.h |  6 ++
 proxy/http/Http1ClientTransaction.h |  5 -
 proxy/http/HttpSM.cc|  3 +++
 proxy/http/HttpSM.h |  1 +
 proxy/http2/Http2ClientSession.cc   | 12 
 proxy/http2/Http2ClientSession.h| 11 +++
 proxy/http2/Http2Stream.h   |  6 --
 proxy/logging/LogAccessHttp.cc  | 22 ++
 11 files changed, 33 insertions(+), 56 deletions(-)


-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 01/01: Merge pull request #846 from masaori335/ts-4726

2016-08-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 41c267d63735ef1bb97459a65dcf0c55fea67987
Merge: fa2072d d3ae487
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Aug 12 11:13:15 2016 +0900

Merge pull request #846 from masaori335/ts-4726

TS-4726: Remove unnecessary assert in ProxyClientTransaction::release

 proxy/ProxyClientTransaction.cc | 4 
 1 file changed, 4 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (fa2072d -> 41c267d)

2016-08-11 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  fa2072d   doc: Fix spelling.
  adds  d3ae487   TS-4726: Remove unnecessary assert in 
ProxyClientTransaction::release
   new  41c267d   Merge pull request #846 from masaori335/ts-4726

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/ProxyClientTransaction.cc | 4 
 1 file changed, 4 deletions(-)

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


[trafficserver] branch master updated (bf82d9f -> 2db110f)

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

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  bf82d9f   Merge pull request #838 from masaori335/ts-4713
  adds  c71fa8c   TS-4554: Add some limitations in Http2DependencyTree
   new  2db110f   Merge pull request #830 from masaori335/ts-4554

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http2/Http2ConnectionState.cc |  27 ++--
 proxy/http2/Http2ConnectionState.h  |   8 +-
 proxy/http2/Http2DependencyTree.h   |  59 -
 proxy/http2/test_Http2DependencyTree.cc | 211 ++--
 4 files changed, 279 insertions(+), 26 deletions(-)

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


[trafficserver] 01/01: Merge pull request #830 from masaori335/ts-4554

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

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 2db110fa56de0158c95f683fdac12d496a8935b0
Merge: bf82d9f c71fa8c
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Aug 9 18:08:35 2016 +0900

Merge pull request #830 from masaori335/ts-4554

TS-4554: Add some limitations in Http2DependencyTree

 proxy/http2/Http2ConnectionState.cc |  27 ++--
 proxy/http2/Http2ConnectionState.h  |   8 +-
 proxy/http2/Http2DependencyTree.h   |  59 -
 proxy/http2/test_Http2DependencyTree.cc | 211 ++--
 4 files changed, 279 insertions(+), 26 deletions(-)


-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 01/01: Merge pull request #838 from masaori335/ts-4713

2016-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit bf82d9f685e41fc05a6adf8554babcbaf1d28a3a
Merge: e4300be 87b898c
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Aug 8 15:15:17 2016 +0900

Merge pull request #838 from masaori335/ts-4713

TS-4713: Remove obsolete TSFetchClientProtoStackSet/Get

 proxy/InkAPI.cc | 18 --
 1 file changed, 18 deletions(-)


-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (e4300be -> bf82d9f)

2016-08-08 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  e4300be   TS-4711: Remove custom logs member variables.
  adds  87b898c   TS-4713: Remove obsolete TSFetchClientProtoStackSet/Get
   new  bf82d9f   Merge pull request #838 from masaori335/ts-4713

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/InkAPI.cc | 18 --
 1 file changed, 18 deletions(-)

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


[trafficserver] 01/01: Merge pull request #767 from masaori335/ts-4605

2016-06-29 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit c64ce724b1fe1225d44ede9967d682bc4c54eed5
Merge: a56c5ac e1a3705
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Jun 30 11:01:15 2016 +0900

Merge pull request #767 from masaori335/ts-4605

TS-4605: fix Coverity issue 1357058

 lib/ts/PriorityQueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (a56c5ac -> c64ce72)

2016-06-29 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  a56c5ac   TS-4550 Adds X-Transaction-Id to xdebug
  adds  e1a3705   TS-4605: fix Coverity issue 1357058
   new  c64ce72   Merge pull request #767 from masaori335/ts-4605

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 lib/ts/PriorityQueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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


[trafficserver] 01/01: Merge pull request #733 from masaori335/ts-4324

2016-06-29 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 3ad8e94d017bd6c34512216dd489a1217d72e456
Merge: c64ce72 54b0d31
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Jun 30 11:39:59 2016 +0900

Merge pull request #733 from masaori335/ts-4324

TS-4324: Allocate 16KB for DATA frame payload exactly

 proxy/http2/Http2ClientSession.h| 47 +
 proxy/http2/Http2ConnectionState.cc |  8 +++
 2 files changed, 25 insertions(+), 30 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (c64ce72 -> 3ad8e94)

2016-06-29 Thread masaori
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  c64ce72   Merge pull request #767 from masaori335/ts-4605
  adds  54b0d31   TS-4324: Allocate 16KB for DATA frame payload exactly
   new  3ad8e94   Merge pull request #733 from masaori335/ts-4324

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 proxy/http2/Http2ClientSession.h| 47 +
 proxy/http2/Http2ConnectionState.cc |  8 +++
 2 files changed, 25 insertions(+), 30 deletions(-)

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


[trafficserver] branch master updated: BoringSSL doesn't have BIO_sock_non_fatal_error()

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

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  2011c40   BoringSSL doesn't have BIO_sock_non_fatal_error()
2011c40 is described below

commit 2011c40429ff638dabe21acd0db31c83296b4b13
Author: Jack Bates <j...@nottheoilrig.com>
AuthorDate: Fri Feb 10 11:04:02 2017 -0700

BoringSSL doesn't have BIO_sock_non_fatal_error()

Fixes #1437
---
 configure.ac   |  1 +
 iocore/net/BIO_fastopen.cc | 61 ++
 2 files changed, 62 insertions(+)

diff --git a/configure.ac b/configure.ac
index 305e432..831a55f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1133,6 +1133,7 @@ TS_ADDTO([LIBS], ["$OPENSSL_LIBS"])
 
 AC_CHECK_FUNCS([ \
   BIO_meth_new \
+  BIO_sock_non_fatal_error \
   CRYPTO_set_mem_functions \
   HMAC_CTX_new \
   X509_get0_signature \
diff --git a/iocore/net/BIO_fastopen.cc b/iocore/net/BIO_fastopen.cc
index 3e8095d..c8ed12b 100644
--- a/iocore/net/BIO_fastopen.cc
+++ b/iocore/net/BIO_fastopen.cc
@@ -27,6 +27,67 @@
 
 #include "BIO_fastopen.h"
 
+// For BoringSSL, which for some reason doesn't have this function.
+// (In BoringSSL, sock_read() and sock_write() use the internal
+// bio_fd_non_fatal_error() instead.) #1437
+//
+// The following is copied from
+// 
https://github.com/openssl/openssl/blob/3befffa39dbaf2688d823fcf2bdfc07d2487be48/crypto/bio/bss_sock.c
+#ifndef HAVE_BIO_SOCK_NON_FATAL_ERROR
+int
+BIO_sock_non_fatal_error(int err)
+{
+  switch (err) {
+#if defined(OPENSSL_SYS_WINDOWS)
+#if defined(WSAEWOULDBLOCK)
+  case WSAEWOULDBLOCK:
+#endif
+#endif
+
+#ifdef EWOULDBLOCK
+#ifdef WSAEWOULDBLOCK
+#if WSAEWOULDBLOCK != EWOULDBLOCK
+  case EWOULDBLOCK:
+#endif
+#else
+  case EWOULDBLOCK:
+#endif
+#endif
+
+#if defined(ENOTCONN)
+  case ENOTCONN:
+#endif
+
+#ifdef EINTR
+  case EINTR:
+#endif
+
+#ifdef EAGAIN
+#if EWOULDBLOCK != EAGAIN
+  case EAGAIN:
+#endif
+#endif
+
+#ifdef EPROTO
+  case EPROTO:
+#endif
+
+#ifdef EINPROGRESS
+  case EINPROGRESS:
+#endif
+
+#ifdef EALREADY
+  case EALREADY:
+#endif
+return (1);
+  /* break; */
+  default:
+break;
+  }
+  return (0);
+}
+#endif
+
 static int (*fastopen_create)(BIO *) = 
BIO_meth_get_create(const_cast(BIO_s_socket()));
 
 static int

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


[trafficserver] 01/01: Merge pull request #951 from masaori335/ts-4797

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

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 698f572f8863d67085eee61fd5e73235ab5fcb92
Merge: e55b046 94fb274
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Sep 8 10:21:45 2016 +0900

Merge pull request #951 from masaori335/ts-4797

TS-4797: Allow backslash-escape in header_rewrite rules

 plugins/header_rewrite/header_rewrite_test.cc | 66 +++
 plugins/header_rewrite/parser.cc  | 11 -
 2 files changed, 76 insertions(+), 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated (e55b046 -> 698f572)

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

masaori pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git.

  from  e55b046   TS-4823: gcc ordered comparison of pointer with integer 
zero warnings Fixed wccp issues
  adds  94fb274   TS-4797: Allow backslash-escape in header_rewrite rules
   new  698f572   Merge pull request #951 from masaori335/ts-4797

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plugins/header_rewrite/header_rewrite_test.cc | 66 +++
 plugins/header_rewrite/parser.cc  | 11 -
 2 files changed, 76 insertions(+), 1 deletion(-)

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


[trafficserver] 01/01: Merge pull request #999 from masaori335/ts-4759

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

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 35f97617e2963dfad26fed5a536ecb8fbce1fd50
Merge: 4d004b2 a907e55
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Sep 12 10:23:18 2016 +0900

Merge pull request #999 from masaori335/ts-4759

TS-4759: Fix stream states management

 proxy/http2/Http2ConnectionState.cc | 63 +++--
 proxy/http2/Http2ConnectionState.h  |  1 +
 proxy/http2/Http2Stream.cc  | 44 +++---
 proxy/http2/Http2Stream.h   |  6 ++--
 4 files changed, 76 insertions(+), 38 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch master updated: TS-4905: Set parent NULL after destroy() is called

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

masaori pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
   new  60d3d1f   TS-4905: Set parent NULL after destroy() is called
60d3d1f is described below

commit 60d3d1fc542f9d33317e35ced399bef1f9c89516
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Oct 4 17:56:45 2016 +0900

TS-4905: Set parent NULL after destroy() is called
---
 proxy/http/Http1ClientTransaction.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/proxy/http/Http1ClientTransaction.cc 
b/proxy/http/Http1ClientTransaction.cc
index 2220e60..5097c8c 100644
--- a/proxy/http/Http1ClientTransaction.cc
+++ b/proxy/http/Http1ClientTransaction.cc
@@ -67,6 +67,7 @@ Http1ClientTransaction::transaction_done()
   // If the parent session is not in the closed state, the destroy will not 
occur.
   if (parent) {
 parent->destroy();
+parent = NULL;
   }
 }
 

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


[trafficserver] branch quic-latest updated: Add draft-05(-pre) support

2017-08-14 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 92741d4  Add draft-05(-pre) support
92741d4 is described below

commit 92741d4334cc3a8b4d87ae310f51c192597b4838
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Aug 15 09:52:55 2017 +0900

Add draft-05(-pre) support

- Change label prefix of Key Expansion
- Change largest length of the Largest Acknowledged field of Ack frame
- Change QUIC_SUPPORTED_VERSIONS
---
 iocore/net/quic/QUICCrypto.cc  | 10 +-
 iocore/net/quic/QUICFrame.cc   | 10 +++---
 iocore/net/quic/QUICTypes.cc   |  6 --
 iocore/net/quic/QUICTypes.h|  8 +++-
 iocore/net/quic/test/test_QUICPacketFactory.cc |  2 +-
 5 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/iocore/net/quic/QUICCrypto.cc b/iocore/net/quic/QUICCrypto.cc
index 2707dfa..f3df0a6 100644
--- a/iocore/net/quic/QUICCrypto.cc
+++ b/iocore/net/quic/QUICCrypto.cc
@@ -36,11 +36,11 @@ constexpr static char tag[] = "quic_crypto";
 constexpr static ts::StringView exporter_label_client_1_rtt("EXPORTER-QUIC 
client 1-RTT Secret", ts::StringView::literal);
 constexpr static ts::StringView exporter_label_server_1_rtt("EXPORTER-QUIC 
server 1-RTT Secret", ts::StringView::literal);
 
-// [quic-tls draft-04] "TLS 1.3, " + Label
-// constexpr static ts::StringView expand_label_client_1_rtt("TLS 1.3, QUIC 
client 1-RTT secret", ts::StringView::literal);
-// constexpr static ts::StringView expand_label_server_1_rtt("TLS 1.3, QUIC 
server 1-RTT secret", ts::StringView::literal);
-constexpr static ts::StringView expand_label_key("TLS 1.3, key", 
ts::StringView::literal);
-constexpr static ts::StringView expand_label_iv("TLS 1.3, iv", 
ts::StringView::literal);
+// [quic-tls draft-05] "tls13 " + Label
+// constexpr static ts::StringView expand_label_client_1_rtt("tls13 QUIC 
client 1-RTT secret", ts::StringView::literal);
+// constexpr static ts::StringView expand_label_server_1_rtt("tls13 QUIC 
server 1-RTT secret", ts::StringView::literal);
+constexpr static ts::StringView expand_label_key("tls13 key", 
ts::StringView::literal);
+constexpr static ts::StringView expand_label_iv("tls13 iv", 
ts::StringView::literal);
 
 //
 // QUICPacketProtection
diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index d7495c7..cf36199 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -327,7 +327,7 @@ QUICAckFrame::store(uint8_t *buf, size_t *len) const
 QUICTypeUtil::write_uint_as_nbytes(this->_largest_acknowledged, 4, p, );
   } else {
 buf[0] += 0x03 << 2;
-QUICTypeUtil::write_uint_as_nbytes(this->_largest_acknowledged, 6, p, );
+QUICTypeUtil::write_uint_as_nbytes(this->_largest_acknowledged, 8, p, );
   }
   p += n;
 
@@ -439,14 +439,10 @@ QUICAckFrame::_get_largest_acknowledged_length() const
* 0 -> 1 byte
* 1 -> 2 byte
* 2 -> 4 byte
-   * 3 -> 6 byte
+   * 3 -> 8 byte
   */
   int n = (this->_buf[0] & 0x0c) >> 2;
-  if (n == 0) {
-return 1;
-  } else {
-return n * 2;
-  }
+  return 0x01 << n;
 }
 
 size_t
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index 0be3d00..cf45000 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -23,12 +23,6 @@
 
 #include "QUICTypes.h"
 
-// TODO: Update version number
-// Note: You need to update QUICTypes.h if you change the number of versions
-const QUICVersion QUIC_SUPPORTED_VERSIONS[] = {
-  0xff04, // Prefix for drafts (0xff00) + draft number
-};
-
 const QUICStreamId STREAM_ID_FOR_HANDSHAKE = 0;
 
 bool
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index d1f613b..abff721 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -45,7 +45,13 @@ typedef uint32_t QUICVersion;
 typedef uint32_t QUICStreamId;
 typedef uint64_t QUICOffset;
 
-extern const QUICVersion QUIC_SUPPORTED_VERSIONS[1];
+// TODO: Update version number
+// Note: You also need to update tests for VersionNegotiationPacket, if you 
change the number of versions
+// Prefix for drafts (0xff00) + draft number
+constexpr QUICVersion QUIC_SUPPORTED_VERSIONS[] = {
+  0xff05,
+};
+
 extern const QUICStreamId STREAM_ID_FOR_HANDSHAKE;
 
 enum class QUICPacketType : int {
diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc 
b/iocore/net/quic/test/test_QUICPacketFactory.cc
index 48f6c5d..31bdbd2 100644
--- a/iocore/net/quic/test/test_QUICPacketFactory.cc
+++ b/iocore/net/quic/test/test_QUICPacketFac

[trafficserver] branch quic-latest updated: Add QUICConfig and proxy.config.quic.no_activity_timeout_in

2017-08-10 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 e8c6b97  Add QUICConfig and proxy.config.quic.no_activity_timeout_in
e8c6b97 is described below

commit e8c6b978ed02ea96b80901f662a47a07d89c34ef
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Aug 10 15:34:56 2017 +0900

Add QUICConfig and proxy.config.quic.no_activity_timeout_in

Add QUICConfig class to load configs related to QUIC.
"proxy.config.quic.no_activity_timeout_in" is also added. Default value is 
30 seconds.
---
 iocore/net/QUICNetProcessor.cc   |  6 ++--
 iocore/net/QUICNetVConnection.cc |  8 +++--
 iocore/net/quic/Makefile.am  |  1 +
 iocore/net/quic/QUICConfig.cc| 74 
 iocore/net/quic/QUICConfig.h | 51 +++
 mgmt/RecordsConfig.cc|  8 +
 6 files changed, 141 insertions(+), 7 deletions(-)

diff --git a/iocore/net/QUICNetProcessor.cc b/iocore/net/QUICNetProcessor.cc
index 40eb37e..7500ab1 100644
--- a/iocore/net/QUICNetProcessor.cc
+++ b/iocore/net/QUICNetProcessor.cc
@@ -24,6 +24,7 @@
 #include "P_Net.h"
 #include "ts/I_Layout.h"
 #include "I_RecHttp.h"
+#include "QUICConfig.h"
 // #include "P_QUICUtils.h"
 
 //
@@ -52,10 +53,7 @@ QUICNetProcessor::start(int, size_t stacksize)
 {
   // This initialization order matters ...
   // QUICInitializeLibrary();
-  // QUICConfig::startup();
-
-  // if (!QUICCertificateConfig::startup())
-  //   return -1;
+  QUICConfig::startup();
 
   // Acquire a QUICConfigParams instance *after* we start QUIC up.
   // QUICConfig::scoped_config params;
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 5eb4130..9898712 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -36,6 +36,7 @@
 #include "QUICEchoApp.h"
 #include "QUICDebugNames.h"
 #include "QUICEvents.h"
+#include "QUICConfig.h"
 
 #define STATE_FROM_VIO(_x) ((NetState *)(((char *)(_x)) - STATE_VIO_OFFSET))
 #define STATE_VIO_OFFSET ((uintptr_t) & ((NetState *)0)->vio)
@@ -267,9 +268,10 @@ QUICNetVConnection::state_handshake(int event, Event *data)
 this->_state = QUICConnectionState::Established;
 
SET_HANDLER((NetVConnHandler)::state_connection_established);
 
-// TODO: switch waiting for a CONNECTION_CLOSE frame for first 
implementation
-// TODO: read idle_timeout from Transport Prameters
-ink_hrtime idle_timeout = HRTIME_SECONDS(3);
+QUICConfig::scoped_config params;
+
+// TODO:  use idle_timeout from negotiated Transport Prameters
+ink_hrtime idle_timeout = HRTIME_SECONDS(params->no_activity_timeout_in());
 this->set_inactivity_timeout(idle_timeout);
 this->add_to_active_queue();
   }
diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index b0b799a..714874c 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -56,6 +56,7 @@ libquic_a_SOURCES = \
   QUICCrypto.cc \
   $(QUICCrypto_impl) \
   QUICAckFrameCreator.cc \
+  QUICConfig.cc \
   QUICDebugNames.cc \
   QUICApplication.cc \
   QUICEchoApp.cc
diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
new file mode 100644
index 000..64b8e90
--- /dev/null
+++ b/iocore/net/quic/QUICConfig.cc
@@ -0,0 +1,74 @@
+/** @file
+ *
+ *  A brief file description
+ *
+ *  @section license License
+ *
+ *  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.
+ */
+
+#include "QUICConfig.h"
+
+#include 
+
+int QUICConfig::_config_id = 0;
+
+//
+// QUICConfigParams
+//
+void
+QUICConfigParams::initialize()
+{
+  REC_EstablishStaticConfigInt32U(this->_no_activity_timeout_in, 
"proxy.config.quic.no_activity_timeout_in");
+}
+
+uint32_t
+QUICConfigParams::no_activity_timeout_in() const
+{
+  return this->_no_activity_timeout_in;
+}
+
+//
+// QUICConfig
+//
+void
+QUICConfig::startup()
+{

[trafficserver] branch quic-latest updated: Print Connection ID on debug logs in QUICNetVConnection

2017-08-13 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 e95c8f3  Print Connection ID on debug logs in QUICNetVConnection
e95c8f3 is described below

commit e95c8f38ca1d029a2218d16d4295a4e10200e2ac
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Aug 14 10:43:48 2017 +0900

Print Connection ID on debug logs in QUICNetVConnection
---
 iocore/net/QUICNetVConnection.cc | 43 
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 9898712..08477fe 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -41,7 +41,8 @@
 #define STATE_FROM_VIO(_x) ((NetState *)(((char *)(_x)) - STATE_VIO_OFFSET))
 #define STATE_VIO_OFFSET ((uintptr_t) & ((NetState *)0)->vio)
 
-const static char *tag = "quic_net";
+#define DebugQUICCon(fmt, ...) \
+  Debug("quic_net", "[%" PRIx64 "] " fmt, 
static_cast(this->_quic_connection_id), ##__VA_ARGS__)
 
 const static uint32_t MINIMUM_MTU = 1280;
 const static uint32_t MAX_PACKET_OVERHEAD = 25; // Max long header len(17) + 
FNV-1a hash len(8)
@@ -106,7 +107,7 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
 void
 QUICNetVConnection::free(EThread *t)
 {
-  Debug(tag, "Free connection: %p", this);
+  DebugQUICCon("Free connection");
 
   this->_udp_con= nullptr;
   this->_packet_handler = nullptr;
@@ -196,14 +197,14 @@ QUICNetVConnection::get_transmitter_mutex()
 void
 QUICNetVConnection::push_packet(std::unique_ptr packet)
 {
-  Debug(tag, "Type=%s Size=%u", QUICDebugNames::packet_type(packet->type()), 
packet->size());
+  DebugQUICCon("Type=%s Size=%u", QUICDebugNames::packet_type(packet->type()), 
packet->size());
   this->_packet_recv_queue.enqueue(const_cast(packet.release()));
 }
 
 void
 QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, 
QUICFrameDeleterFunc> frame)
 {
-  Debug(tag, "Type=%s Size=%zu", QUICDebugNames::frame_type(frame->type()), 
frame->size());
+  DebugQUICCon("Type=%s Size=%zu", QUICDebugNames::frame_type(frame->type()), 
frame->size());
   this->_frame_buffer.push(std::move(frame));
   eventProcessor.schedule_imm(this, ET_CALL, QUIC_EVENT_PACKET_WRITE_READY, 
nullptr);
 }
@@ -255,16 +256,16 @@ QUICNetVConnection::state_handshake(int event, Event 
*data)
 break;
   }
   default:
-Debug(tag, "Unexpected event: %u", event);
+DebugQUICCon("Unexpected event: %u", event);
   }
 
   if (error.cls != QUICErrorClass::NONE) {
 // TODO: Send error if needed
-Debug(tag, "QUICError: cls=%u, code=0x%x", static_cast(error.cls), static_cast(error.code));
+DebugQUICCon("QUICError: cls=%u, code=0x%x", static_cast(error.cls), static_cast(error.code));
   }
 
   if (this->_handshake_handler && this->_handshake_handler->is_completed()) {
-Debug(tag, "Enter state_connection_established");
+DebugQUICCon("Enter state_connection_established");
 this->_state = QUICConnectionState::Established;
 
SET_HANDLER((NetVConnHandler)::state_connection_established);
 
@@ -309,7 +310,7 @@ QUICNetVConnection::state_connection_established(int event, 
Event *data)
 this->remove_from_active_queue();
 
 // TODO: signal VC_EVENT_ACTIVE_TIMEOUT/VC_EVENT_INACTIVITY_TIMEOUT to 
application
-Debug(tag, "Enter state_connection_close");
+DebugQUICCon("Enter state_connection_close");
 this->_state = QUICConnectionState::Closing;
 SET_HANDLER((NetVConnHandler)::state_connection_closed);
 
@@ -318,12 +319,12 @@ QUICNetVConnection::state_connection_established(int 
event, Event *data)
 break;
   }
   default:
-Debug(tag, "Unexpected event: %u", event);
+DebugQUICCon("Unexpected event: %u", event);
   }
 
   if (error.cls != QUICErrorClass::NONE) {
 // TODO: Send error if needed
-Debug(tag, "QUICError: cls=%u, code=0x%x", static_cast(error.cls), static_cast(error.code));
+DebugQUICCon("QUICError: cls=%u, code=0x%x", static_cast(error.cls), static_cast(error.code));
   }
 
   return EVENT_CONT;
@@ -360,7 +361,7 @@ QUICNetVConnection::state_connection_closed(int event, 
Event *data)
 break;
   }
   default:
-Debug(tag, "Unexpected event: %u", event);
+DebugQUICCon("Unexpected event: %u", event);
   }
 
   return EVENT_DONE;
@@ -379,7 +380,7 @@ QUICNetVConnection::get_application(QUICStreamId stream_id)
 return static_cast(this->_handshake_handler);
   } else {
 if (!this->_application

[trafficserver] branch master updated: H2 Assert fails sometimes at Http2DependencyTree::deactivate

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

masaori 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 f5b5ff8  H2 Assert fails sometimes at Http2DependencyTree::deactivate
f5b5ff8 is described below

commit f5b5ff8f923a1873560e14be8cb7ed709ed0e7bb
Author: scw00 <sc...@apache.org>
AuthorDate: Sat Jul 22 05:30:09 2017 +0800

H2 Assert fails sometimes at Http2DependencyTree::deactivate
---
 proxy/http2/Http2ConnectionState.cc | 10 +-
 proxy/http2/Http2ConnectionState.h  |  2 +-
 proxy/http2/Http2DependencyTree.h   |  2 --
 proxy/http2/Http2Stream.h   |  2 --
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index d1639a5..c397d36 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1029,7 +1029,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, 
Http2Error )
   ink_assert(nullptr != new_stream);
   ink_assert(!stream_list.in(new_stream));
 
-  stream_list.push(new_stream);
+  stream_list.enqueue(new_stream);
   if (client_streamid) {
 latest_streamid_in = new_id;
 ink_assert(client_streams_in_count < UINT32_MAX);
@@ -1055,7 +1055,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, 
Http2Error )
 Http2Stream *
 Http2ConnectionState::find_stream(Http2StreamId id) const
 {
-  for (Http2Stream *s = stream_list.head; s; s = s->link.next) {
+  for (Http2Stream *s = stream_list.head; s; s = static_cast(s->link.next)) {
 if (s->get_id() == id) {
   return s;
 }
@@ -1070,7 +1070,7 @@ Http2ConnectionState::restart_streams()
   Http2Stream *s = stream_list.head;
 
   while (s) {
-Http2Stream *next = s->link.next;
+Http2Stream *next = static_cast(s->link.next);
 if (!s->is_closed() && s->get_state() == 
Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE &&
 min(this->client_rwnd, s->client_rwnd) > 0) {
   s->send_response_body();
@@ -1085,7 +1085,7 @@ Http2ConnectionState::cleanup_streams()
 {
   Http2Stream *s = stream_list.head;
   while (s) {
-Http2Stream *next = s->link.next;
+Http2Stream *next = static_cast(s->link.next);
 this->delete_stream(s);
 ink_assert(s != next);
 s = next;
@@ -1177,7 +1177,7 @@ void
 Http2ConnectionState::update_initial_rwnd(Http2WindowSize new_size)
 {
   // Update stream level window sizes
-  for (Http2Stream *s = stream_list.head; s; s = s->link.next) {
+  for (Http2Stream *s = stream_list.head; s; s = static_cast(s->link.next)) {
 s->client_rwnd = new_size - 
(client_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) - s->client_rwnd);
   }
 }
diff --git a/proxy/http2/Http2ConnectionState.h 
b/proxy/http2/Http2ConnectionState.h
index 3e8e75f..94d1d2c 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -274,7 +274,7 @@ private:
   //   is CLOSED.
   //   If given Stream Identifier is not found in stream_list and it is greater
   //   than latest_streamid_in, the state of Stream is IDLE.
-  DLL stream_list;
+  Queue stream_list;
   Http2StreamId latest_streamid_in  = 0;
   Http2StreamId latest_streamid_out = 0;
   int stream_requests   = 0;
diff --git a/proxy/http2/Http2DependencyTree.h 
b/proxy/http2/Http2DependencyTree.h
index 8a16c13..007603b 100644
--- a/proxy/http2/Http2DependencyTree.h
+++ b/proxy/http2/Http2DependencyTree.h
@@ -316,8 +316,6 @@ Http2DependencyTree::deactivate(Node *node, uint32_t 
sent)
   node->active = false;
 
   while (node->queue->empty() && node->parent != NULL) {
-ink_assert(node->parent->queue->top() == node->entry);
-
 node->parent->queue->pop();
 node->queued = false;
 
diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h
index e77a2a2..d9828cc 100644
--- a/proxy/http2/Http2Stream.h
+++ b/proxy/http2/Http2Stream.h
@@ -153,8 +153,6 @@ public:
   ssize_t client_rwnd;
   ssize_t server_rwnd = Http2::initial_window_size;
 
-  LINK(Http2Stream, link);
-
   uint8_t *header_blocks= nullptr;
   uint32_t header_blocks_length = 0;  // total length of header blocks (not 
include
   // Padding or other fields)

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


[trafficserver] 01/02: Fix UnixUDPNet

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

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

commit 3686807f3906c6dc132683f34b981da2d8910309
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Jun 13 15:25:27 2017 +0900

Fix UnixUDPNet
---
 iocore/net/UnixUDPNet.cc | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index 1a201c2..f54f74d 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -574,7 +574,9 @@ UDPNetProcessor::UDPBind(Continuation *cont, sockaddr const 
*addr, int send_bufs
   int fd   = -1;
   UnixUDPConnection *n = nullptr;
   IpEndpoint myaddr;
-  int myaddr_len = sizeof(myaddr);
+  int myaddr_len = sizeof(myaddr);
+  PollCont *pc   = nullptr;
+  PollDescriptor *pd = nullptr;
 
   if ((res = socketManager.socket(addr->sa_family, SOCK_DGRAM, 0)) < 0) {
 goto Lerror;
@@ -616,6 +618,12 @@ UDPNetProcessor::UDPBind(Continuation *cont, sockaddr 
const *addr, int send_bufs
   n->setBinding();
   n->bindToThread(cont);
 
+  pc = get_UDPPollCont(n->ethread);
+  pd = pc->pollDescriptor;
+
+  n->ethread->ep = (EventIO *)ats_malloc(sizeof(EventIO));
+  n->ethread->ep->start(pd, n, EVENTIO_READ);
+
   cont->handleEvent(NET_EVENT_DATAGRAM_OPEN, n);
   return ACTION_RESULT_DONE;
 Lerror:
@@ -765,8 +773,8 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* 
pktLen ATS_UNUSED */)
   msg.msg_controllen = 0;
   msg.msg_flags  = 0;
 #endif
-  msg.msg_name= (caddr_t)>to;
-  msg.msg_namelen = sizeof(p->to);
+  msg.msg_name= (caddr_t)>to.sa;
+  msg.msg_namelen = sizeof(p->to.sa);
   iov_len = 0;
 
   for (IOBufferBlock *b = p->chain.get(); b != nullptr; b = b->next.get()) {

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 02/02: Fix UDP Echo Server

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

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

commit 68344296efa16675ce40eaf02a05cd7a7e894746
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Jun 13 16:24:57 2017 +0900

Fix UDP Echo Server
---
 .gitignore  |   1 +
 iocore/net/I_UDPNet.h   |   1 +
 iocore/net/Makefile.am  |  32 -
 iocore/net/P_UDPNet.h   |   2 -
 iocore/net/P_UnixNet.h  |   1 +
 iocore/net/test_I_UDPNet.cc | 321 ++--
 iocore/net/test_P_UDPNet.cc | 112 
 7 files changed, 312 insertions(+), 158 deletions(-)

diff --git a/.gitignore b/.gitignore
index 18c8bd2..6c62df4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,7 @@ lib/ts/test_Scalar
 lib/perl/lib/Apache/TS.pm
 
 iocore/net/test_certlookup
+iocore/net/test_UDPNet
 iocore/aio/test_AIO
 iocore/eventsystem/test_Buffer
 iocore/eventsystem/test_Event
diff --git a/iocore/net/I_UDPNet.h b/iocore/net/I_UDPNet.h
index 6f8fe6f..b8379eb 100644
--- a/iocore/net/I_UDPNet.h
+++ b/iocore/net/I_UDPNet.h
@@ -104,6 +104,7 @@ public:
 };
 
 inkcoreapi extern UDPNetProcessor 
+extern EventType ET_UDP;
 
 #include "I_UDPPacket.h"
 #include "I_UDPConnection.h"
diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am
index 517a8f0..f994b54 100644
--- a/iocore/net/Makefile.am
+++ b/iocore/net/Makefile.am
@@ -31,7 +31,7 @@ AM_CPPFLAGS += \
 
 TESTS = $(check_PROGRAMS)
 
-check_PROGRAMS = test_certlookup
+check_PROGRAMS = test_certlookup test_UDPNet
 noinst_LIBRARIES = libinknet.a
 
 test_certlookup_LDFLAGS = \
@@ -47,6 +47,32 @@ test_certlookup_LDADD = \
   $(top_builddir)/lib/ts/libtsutil.la \
   $(top_builddir)/iocore/eventsystem/libinkevent.a
 
+test_UDPNet_CPPFLAGS = \
+  $(AM_CPPFLAGS) \
+  $(iocore_include_dirs) \
+  -I$(abs_top_srcdir)/proxy \
+  -I$(abs_top_srcdir)/proxy/hdrs \
+  -I$(abs_top_srcdir)/proxy/http \
+  -I$(abs_top_srcdir)/proxy/logging \
+  -I$(abs_top_srcdir)/mgmt \
+  -I$(abs_top_srcdir)/mgmt/utils \
+  @OPENSSL_INCLUDES@
+
+test_UDPNet_LDFLAGS = \
+  @AM_LDFLAGS@ \
+  @OPENSSL_LDFLAGS@
+
+test_UDPNet_LDADD = \
+  libinknet.a \
+  $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/mgmt/libmgmt_p.la \
+  $(top_builddir)/lib/records/librecords_p.a \
+  $(top_builddir)/lib/ts/libtsutil.la \
+  @LIBTCL@ @HWLOC_LIBS@
+
+test_UDPNet_SOURCES = \
+  test_I_UDPNet.cc
+
 libinknet_a_SOURCES = \
   BIO_fastopen.cc \
   BIO_fastopen.h \
@@ -121,9 +147,7 @@ libinknet_a_SOURCES = \
 #test_UNUSED_SOURCES = \
 #  NetTest-http-server.c \
 #  test_I_Net.cc \
-#  test_I_UDPNet.cc \
-#  test_P_Net.cc \
-#  test_P_UDPNet.cc
+#  test_P_Net.cc
 
 if BUILD_TESTS
   libinknet_a_SOURCES += \
diff --git a/iocore/net/P_UDPNet.h b/iocore/net/P_UDPNet.h
index d1a6644..a093bb8 100644
--- a/iocore/net/P_UDPNet.h
+++ b/iocore/net/P_UDPNet.h
@@ -31,8 +31,6 @@
 #ifndef __P_UDPNET_H_
 #define __P_UDPNET_H_
 
-extern EventType ET_UDP;
-
 #include "I_UDPNet.h"
 #include "P_UDPPacket.h"
 
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index bd9b15a..97a1aea 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -104,6 +104,7 @@ struct EventIO {
   EventIO() { data.c = nullptr; }
 };
 
+#include "P_Net.h"
 #include "P_UnixNetProcessor.h"
 #include "P_UnixNetVConnection.h"
 #include "P_NetAccept.h"
diff --git a/iocore/net/test_I_UDPNet.cc b/iocore/net/test_I_UDPNet.cc
index 81afcce..b8358ee 100644
--- a/iocore/net/test_I_UDPNet.cc
+++ b/iocore/net/test_I_UDPNet.cc
@@ -21,92 +21,333 @@
   limitations under the License.
  */
 
-#include 
-#include 
+#include 
+#include 
+#include 
 
+#include "ts/I_Layout.h"
+#include "ts/TestBox.h"
+
+#include "I_EventSystem.h"
 #include "I_Net.h"
-#include "ts/List.h"
+#include "I_UDPNet.h"
+#include "I_UDPPacket.h"
+#include "I_UDPConnection.h"
 
 #include "diags.i"
 
+static const int port   = 4443;
+static const char payload[] = "hello";
+
 /*This implements a standard Unix echo server: just send every udp packet you
   get back to where it came from*/
 
 class EchoServer : public Continuation
 {
-  int sock_fd;
-  UDPConnection *conn;
-
-  int handlePacket(int event, void *data);
-
 public:
-  EchoServer() : Continuation(new_ProxyMutex()){};
-
-  bool Start(int port);
+  EchoServer() : Continuation(new_ProxyMutex()) { 
SET_HANDLER(::start); };
+  bool start();
+  int handle_packet(int event, void *data);
 };
 
 bool
-EchoServer::Start(int port)
+EchoServer::start()
 {
-  Action *action;
-  sockaddr_in addr;
-
-  if (!udpNet.CreateUDPSocket(_fd, , , port))
-return false;
+  SET_HANDLER(::handle_packet);
 
-  conn = new_UDPConnection(sock_fd);
-  conn->bindToThread(this);
+  sockaddr_in addr

[trafficserver] branch quic-latest updated (c2bc17d -> e634659)

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

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


from c2bc17d  Add range check of Http2SettingsIdentifier
 add c6b7270  Remove useless name from ink_mutex_init.
 add 25b20bf  More NULL to nullptr conversion
 add 3a8a58c  Clang-Tidy cleanup: Bad brace placement in ifdef'd code.
 add 7dfa864  Add RAII support for ink_mutex.
 add 9a4aa33  cid 1375841: Replace strncpy with memcpy
 add bb71401  Require at least one ET_TASK thread
 add 5b94a62  proxy.config.ssl.number.threads does not exist
 add c05264f  Use our ATS server to proxy for Bintray
 add b339d53  ProtocolStack - fix user agent side IPv6 detection.
 add adb998c  Documented more detail about TS_HTTP_SEND_REQUEST_HDR_HOOK 
hook
 add 4704525  Changes the default for 
proxy.config.ssl.server.multicert.exit_on_load_fail
 add 6c67bf0  Rename "ink_mutex_lock" to "ink_scoped_mutex_lock" for better 
consistency.
 add 4576555  Removes the cp of clang-format, our ATS can handle the load
 add 11cc5d4  Allow the tool to apply multiple PRs
 add c04d7fd  PR #2010 follow up. - incorporate OKnet recommendations. - 
Use ink_scoped_mutex_lock from PR #2014.
 add 0169ccf  TS-4265: Change EventProcessor to use declaration 
initialization.
 add a62437a  Permissive mode for server verification
 add 68022cc  Via: Enable detail level in VIA protocol stack.
 add 48cb768  uses AM_C*FLAGS instead of C*FLAGS
 add 800f69e  fix 100-continue
 add 6521444  fix bg_fill abort when server completed
 add c128363  Fix SSL handshake problems.
 add 8dd4aa9  Disable the post_transform retry due to coredump
 add 51cc066  Break fix.
 add 649f4e0  volume.config doesn't differentiate http/https
 add 9e38ee8  Make the default thread stack size global and configurable.
 add 53d5da0  Update testing extensions
 add a554692  Prevent traffic_ctl from writing on a socket that is not 
connected.
 add 93186e2  esi: remove unnecessary isCacheObjTransformable()
 add a48fe23  Fix for CID-1375917
 add 0b900a6  fix memory leak in SSLInitServerContext
 add 4a09bf5  HTTP2 non persistent metrics sticking over system crash.
 add 9c305c2  Doc update: proxy.config.ssl.client.verify.server
 add 6f0bc84  Prevent potential dispatch of HttpTunnel events to a dead 
consumer.
 add 89403ff  Cleanup server_entry before do dns lookup
 add 424bee2  fix memory leak issue with lua plugin
 add 04f8a18  Coverity 1021734 Uninitialized pointer field
 add a6c14f0  Move where the HttpSM setup for redirect before going to 
origin
 add cd4d6b4  Refactor ProcessManager to stop the poll thread.
 add 6bcfa08  Simplify ProcessManager message and shutdown handling.
 add 8c4a0ea  Wake the process manager thread on shutdown.
 add 693839a  Improve graceful shutdown.
 add c696cb3  Document traffic_server signals.
 add da1ce2c  Revert "Add logic to flush gcov data from traffic_server on 
interrupt."
 add 0d7a530  Remove a redundant access specifier
 add 54528f7  Address session/transaction close errors.
 add 2db2c9f  Only use the start pipelines to start branch build
 add a096d3d  fix intermittent mac os parent selection regression test 
failure.
 add 5954626  Fix readme formatting
 add 959ab14  adds autest gitignore enhancements
 add 15961e7  Ran clang-tidy with modernize-use-using
 add 92b168d  Cleanup after running clang-tidy modernize-use-using
 add 43e299f  Disable cache volume size check for already configured 
volumes.
 add 2bbcfe6  Thread class cleanup. For #1997.
 add 407efa1  coverity fix for buffer_upload plugin
 add e27c09b  Cleanup in EThread. For #1997.
 add 7799320  coverty 1196454: resource leak in buffer_upload plugin
 add 7ea644a  remove bad check
 add caf5f69  Add back in length check to fail H2 headers with no name.
 add f770aaa  coverity fixes for esi
 add a3dc6ad  Add active_thread container support to Event Processor. For 
#1997.
 add efe4fc8  PR-2073 format fixup.
 add a82efb7  Issue #1685: Use TS_MILESTONE_UA_BEGIN for cqt* log fields
 add 63b34dc  Fix session-based memory leak.
 add 4d9279c  Revert "TS-4796 Change UnixNetHandler to always bubble up 
epoll errors to the VConnection" this reverts PRs #1559, #1522 and #947
 add 4b42ada  Fix Lua metrics configuration reloading.
 add 72b55ab  Do not try to push to the docs tree unless we have permissions
 add c12d95e  Ran unifdef to remove INACTIVITY_TIMEOUT code blocks
 add de24ebb  Gracefully shut down traffic_server on SIGINT.
 add a3995c0  Fix library linkage for example plugins.
 add 3580ec8  Add override specifiers to Http2Stream class
 add c652da9  Fix unintialized request_content_length in 
HttpSM::s

[trafficserver] branch quic-latest updated: Close QUIC Connection by inactivity timeout

2017-08-09 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 7052a17  Close QUIC Connection by inactivity timeout
7052a17 is described below

commit 7052a17f4e884e013d6efc78167375a6e2787093
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 9 15:20:35 2017 +0900

Close QUIC Connection by inactivity timeout
---
 iocore/net/P_QUICNetVConnection.h   | 30 +++
 iocore/net/P_UnixNetVConnection.h   | 15 
 iocore/net/QUICNetVConnection.cc| 75 ++---
 iocore/net/quic/QUICEvents.h|  1 +
 iocore/net/quic/QUICLossDetector.cc | 14 ++-
 iocore/net/quic/QUICLossDetector.h  |  1 +
 6 files changed, 114 insertions(+), 22 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index e0bd7cc..09caae2 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -93,6 +93,15 @@ typedef enum {
   QUIC_HOOK_OP_LAST = QUIC_HOOK_OP_TERMINATE ///< End marker value.
 } QuicVConnOp;
 
+enum class QUICConnectionState {
+  Open = 0,
+  Handshake,
+  Established,
+  TimeWait,
+  Closing,
+  Closed,
+};
+
 //
 //
 //  class NetVConnection
@@ -113,20 +122,23 @@ class QUICLossDetector;
  *
  * state_handshake()
  *  | READ:
- *  |  _state_handshake_process_initial_client_packet()
- *  |  _state_handshake_process_client_cleartext_packet()
- *  |  _state_handshake_process_zero_rtt_protected_packet()
+ *  |   _state_handshake_process_initial_client_packet()
+ *  |   _state_handshake_process_client_cleartext_packet()
+ *  |   _state_handshake_process_zero_rtt_protected_packet()
  *  | WRITE:
- *  |  _state_common_send_packet()
+ *  |   _state_common_send_packet()
  *  v
  * state_connection_established()
  *  | READ:
- *  |  _state_connection_established_process_packet()
+ *  |   _state_connection_established_process_packet()
  *  | WRITE:
- *  |  _state_common_send_packet()
+ *  |   _state_common_send_packet()
  *  v
- *  X
- *
+ * state_connection_close()
+ *READ:
+ *  Do nothing
+ *WRITE:
+ *  _state_common_send_packet()
  **/
 class QUICNetVConnection : public UnixNetVConnection, public 
QUICPacketTransmitter, public QUICFrameTransmitter
 {
@@ -143,6 +155,7 @@ public:
   int startEvent(int event, Event *e);
   int state_handshake(int event, Event *data);
   int state_connection_established(int event, Event *data);
+  int state_connection_closed(int event, Event *data);
   void start(SSL_CTX *);
   uint32_t maximum_quic_packet_size();
   uint32_t minimum_quic_packet_size();
@@ -168,6 +181,7 @@ private:
   QUICPacketFactory _packet_factory;
   QUICFrameFactory _frame_factory;
   QUICAckFrameCreator _ack_frame_creator;
+  QUICConnectionState _state = QUICConnectionState::Open;
 
   uint32_t _pmtu = 1280;
 
diff --git a/iocore/net/P_UnixNetVConnection.h 
b/iocore/net/P_UnixNetVConnection.h
index c86a136..91b8d2c 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -150,14 +150,14 @@ public:
   // called when handing an  event from this NetVConnection,//
   // or the NetVConnection creation callback.   //
   
-  void set_active_timeout(ink_hrtime timeout_in) override;
-  void set_inactivity_timeout(ink_hrtime timeout_in) override;
-  void cancel_active_timeout() override;
-  void cancel_inactivity_timeout() override;
+  virtual void set_active_timeout(ink_hrtime timeout_in) override;
+  virtual void set_inactivity_timeout(ink_hrtime timeout_in) override;
+  virtual void cancel_active_timeout() override;
+  virtual void cancel_inactivity_timeout() override;
   void set_action(Continuation *c) override;
-  void add_to_keep_alive_queue() override;
-  void remove_from_keep_alive_queue() override;
-  bool add_to_active_queue() override;
+  virtual void add_to_keep_alive_queue() override;
+  virtual void remove_from_keep_alive_queue() override;
+  virtual bool add_to_active_queue() override;
   virtual void remove_from_active_queue();
 
   // The public interface is VIO::reenable()
@@ -432,5 +432,6 @@ UnixNetVConnection::set_action(Continuation *c)
 void close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t);
 void write_to_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread);
 void write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread);
+void net_activity(UnixNetVConnection *vc, EThread *thread);
 
 #endif
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index afb4226..5eb4130 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -49,6 +49,7 @@ ClassAllocator 
quicNetVCAllocator("quic

[trafficserver] 05/05: Fix max data size of STREAM frame

2017-08-17 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

commit 6ea3b7d6c2bd0dc32c88f90e841c6d7092ff12b7
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Aug 18 14:40:32 2017 +0900

Fix max data size of STREAM frame
---
 iocore/net/P_QUICNetVConnection.h   |  1 +
 iocore/net/QUICNetVConnection.cc| 16 +---
 iocore/net/quic/Mock.h  | 14 +-
 iocore/net/quic/QUICFrameTransmitter.h  |  1 +
 iocore/net/quic/QUICStream.cc   | 10 --
 iocore/net/quic/QUICStream.h|  6 --
 iocore/net/quic/QUICStreamManager.cc|  2 +-
 iocore/net/quic/test/test_QUICStream.cc |  6 +++---
 8 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 1a143b9..8f51030 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -165,6 +165,7 @@ public:
   QUICCrypto *get_crypto() override;
   uint32_t maximum_quic_packet_size() override;
   uint32_t minimum_quic_packet_size() override;
+  uint32_t maximum_stream_frame_data_size() override;
   uint32_t pmtu() override;
   void close(QUICError error) override;
 
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 421555a..b09e930 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -44,8 +44,9 @@
 #define DebugQUICCon(fmt, ...) \
   Debug("quic_net", "[%" PRIx64 "] " fmt, 
static_cast(this->_quic_connection_id), ##__VA_ARGS__)
 
-const static uint32_t MINIMUM_MTU = 1280;
-const static uint32_t MAX_PACKET_OVERHEAD = 25; // Max long header len(17) + 
FNV-1a hash len(8)
+const static uint32_t MINIMUM_MTU   = 1280;
+const static uint32_t MAX_PACKET_OVERHEAD   = 25; // Max long header 
len(17) + FNV-1a hash len(8)
+const static uint32_t MAX_STREAM_FRAME_OVERHEAD = 15;
 
 ClassAllocator quicNetVCAllocator("quicNetVCAllocator");
 
@@ -159,6 +160,12 @@ QUICNetVConnection::maximum_quic_packet_size()
   }
 }
 
+uint32_t
+QUICNetVConnection::maximum_stream_frame_data_size()
+{
+  return this->maximum_quic_packet_size() - MAX_STREAM_FRAME_OVERHEAD - 
MAX_PACKET_OVERHEAD;
+}
+
 void
 QUICNetVConnection::transmit_packet(std::unique_ptr packet)
 {
@@ -287,7 +294,8 @@ QUICNetVConnection::state_handshake(int event, Event *data)
 
   if (error.cls != QUICErrorClass::NONE) {
 // TODO: Send error if needed
-DebugQUICCon("QUICError: cls=%u, code=0x%x", static_cast(error.cls), static_cast(error.code));
+DebugQUICCon("QUICError: %s (%u), %s (0x%x)", 
QUICDebugNames::error_class(error.cls), static_cast(error.cls),
+ QUICDebugNames::error_code(error.code), static_cast(error.code));
   }
 
   if (this->_handshake_handler && this->_handshake_handler->is_completed()) {
@@ -446,6 +454,8 @@ QUICError
 
QUICNetVConnection::_state_handshake_process_initial_client_packet(std::unique_ptr packet)
 {
   if (packet->size() < this->minimum_quic_packet_size()) {
+DebugQUICCon("%" PRId32 ", %" PRId32, packet->size(), 
this->minimum_quic_packet_size());
+
 return QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
   }
 
diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 6aab611..561feeb 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -88,6 +88,12 @@ public:
   }
 
   uint32_t
+  maximum_stream_frame_data_size() override
+  {
+return 1160;
+  }
+
+  uint32_t
   pmtu() override
   {
 return 1280;
@@ -142,8 +148,14 @@ public:
 class MockQUICFrameTransmitter : public QUICFrameTransmitter
 {
   void
-  transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> frame)
+  transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> frame) 
override
+  {
+  }
+
+  uint32_t
+  maximum_stream_frame_data_size() override
   {
+return 1160;
   }
 };
 
diff --git a/iocore/net/quic/QUICFrameTransmitter.h 
b/iocore/net/quic/QUICFrameTransmitter.h
index 8612daf..ce3c267 100644
--- a/iocore/net/quic/QUICFrameTransmitter.h
+++ b/iocore/net/quic/QUICFrameTransmitter.h
@@ -34,4 +34,5 @@ public:
* This sends QUIC_PACKET_WRITE_READY event.
*/
   virtual void transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> 
frame) = 0;
+  virtual uint32_t maximum_stream_frame_data_size() = 0;
 };
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index f80ed0f..db25063 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -30,11 +30,11 @@
 const static char *tag = "quic_stream";
 
 void
-QUICStream::init(QUICStreamManager *manager, QUICStreamId id)
+QUICStream::init(QUICStreamManager *manager, QUI

[trafficserver] 02/05: Set IPV6_V6ONLY socket option

2017-08-17 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

commit 8eaad3da7e604b97fe3dc9c34d3094aad3bed3b1
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Aug 18 14:32:45 2017 +0900

Set IPV6_V6ONLY socket option
---
 iocore/net/UnixUDPNet.cc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index b925c05..c6d4602 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -595,6 +595,10 @@ UDPNetProcessor::UDPBind(Continuation *cont, sockaddr 
const *addr, int send_bufs
 }
   }
 
+  if (ats_is_ip6(addr) && (res = safe_setsockopt(fd, IPPROTO_IPV6, 
IPV6_V6ONLY, SOCKOPT_ON, sizeof(int))) < 0) {
+goto Lerror;
+  }
+
   if ((res = socketManager.ink_bind(fd, addr, ats_ip_size(addr))) < 0) {
 goto Lerror;
   }
@@ -630,6 +634,8 @@ Lerror:
   if (fd != NO_FD) {
 socketManager.close(fd);
   }
+  Debug("udpnet", "Error: %s (%d)", strerror(errno), errno);
+
   cont->handleEvent(NET_EVENT_DATAGRAM_ERROR, nullptr);
   return ACTION_IO_ERROR;
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch quic-latest updated (6a633e6 -> 6ea3b7d)

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

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


from 6a633e6  Fix TLS 1.3 check
 new 8f7f0a8  Add QUICDebugNames::error_class and QUICDebugNames::error_code
 new 8eaad3d  Set IPV6_V6ONLY socket option
 new 5fe8924  Fix "Invalid argument" error on sending UDP packet
 new 2ec9b80  Set sa_family when initialize QUICNetVConnection
 new 6ea3b7d  Fix max data size of STREAM frame

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/P_QUICNetVConnection.h   |  1 +
 iocore/net/QUICNetVConnection.cc| 16 ++---
 iocore/net/QUICPacketHandler.cc |  3 +++
 iocore/net/UnixUDPNet.cc| 12 +-
 iocore/net/quic/Mock.h  | 14 +++-
 iocore/net/quic/QUICDebugNames.cc   | 40 +
 iocore/net/quic/QUICDebugNames.h|  3 +++
 iocore/net/quic/QUICFrameTransmitter.h  |  1 +
 iocore/net/quic/QUICStream.cc   | 10 -
 iocore/net/quic/QUICStream.h|  6 +++--
 iocore/net/quic/QUICStreamManager.cc|  2 +-
 iocore/net/quic/test/test_QUICStream.cc |  6 ++---
 12 files changed, 97 insertions(+), 17 deletions(-)

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


[trafficserver] 01/05: Add QUICDebugNames::error_class and QUICDebugNames::error_code

2017-08-17 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

commit 8f7f0a8300e20b55c61f76acf355439710e1add4
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Aug 18 14:30:55 2017 +0900

Add QUICDebugNames::error_class and QUICDebugNames::error_code
---
 iocore/net/quic/QUICDebugNames.cc | 40 +++
 iocore/net/quic/QUICDebugNames.h  |  3 +++
 2 files changed, 43 insertions(+)

diff --git a/iocore/net/quic/QUICDebugNames.cc 
b/iocore/net/quic/QUICDebugNames.cc
index 74f7a2a..b3c738c 100644
--- a/iocore/net/quic/QUICDebugNames.cc
+++ b/iocore/net/quic/QUICDebugNames.cc
@@ -91,6 +91,46 @@ QUICDebugNames::frame_type(QUICFrameType type)
 }
 
 const char *
+QUICDebugNames::error_class(QUICErrorClass cls)
+{
+  switch (cls) {
+  case QUICErrorClass::NONE:
+return "NONE";
+  case QUICErrorClass::AQPPLICATION_SPECIFIC:
+return "AQPPLICATION_SPECIFIC";
+  case QUICErrorClass::HOST_LOCAL:
+return "HOST_LOCAL";
+  case QUICErrorClass::QUIC_TRANSPORT:
+return "QUIC_TRANSPORT";
+  case QUICErrorClass::CRYPTOGRAPHIC:
+return "CRYPTOGRAPHIC";
+  default:
+return "UNKNOWN";
+  }
+}
+
+const char *
+QUICDebugNames::error_code(QUICErrorCode code)
+{
+  switch (code) {
+  case QUICErrorCode::APPLICATION_SPECIFIC_ERROR:
+return "APPLICATION_SPECIFIC_ERROR";
+  case QUICErrorCode::HOST_LOCAL_ERROR:
+return "HOST_LOCAL_ERROR";
+  case QUICErrorCode::QUIC_TRANSPORT_ERROR:
+return "QUIC_TRANSPORT_ERROR";
+  case QUICErrorCode::QUIC_INTERNAL_ERROR:
+return "QUIC_INTERNAL_ERROR";
+  case QUICErrorCode::CRYPTOGRAPHIC_ERROR:
+return "CRYPTOGRAPHIC_ERROR";
+  case QUICErrorCode::TLS_HANDSHAKE_FAILED:
+return "TLS_HANDSHAKE_FAILED";
+  default:
+return "UNKNOWN";
+  }
+}
+
+const char *
 QUICDebugNames::vc_event(int event)
 {
   switch (event) {
diff --git a/iocore/net/quic/QUICDebugNames.h b/iocore/net/quic/QUICDebugNames.h
index a6fe715..fabd076 100644
--- a/iocore/net/quic/QUICDebugNames.h
+++ b/iocore/net/quic/QUICDebugNames.h
@@ -30,6 +30,9 @@ class QUICDebugNames
 public:
   static const char *packet_type(QUICPacketType type);
   static const char *frame_type(QUICFrameType type);
+  static const char *error_class(QUICErrorClass cls);
+  static const char *error_code(QUICErrorCode code);
+
   // TODO: move to somewhere
   static const char *vc_event(int event);
 };

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 04/05: Set sa_family when initialize QUICNetVConnection

2017-08-17 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

commit 2ec9b809a898c083bad84abfff87e3dd99416c36
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Aug 18 14:38:11 2017 +0900

Set sa_family when initialize QUICNetVConnection
---
 iocore/net/QUICPacketHandler.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc
index 9286ada..2edb338 100644
--- a/iocore/net/QUICPacketHandler.cc
+++ b/iocore/net/QUICPacketHandler.cc
@@ -115,6 +115,9 @@ QUICPacketHandler::_recv_packet(int event, UDPPacket 
*udpPacket)
 vc->set_context(NET_VCONNECTION_IN);
 vc->read.triggered = 1;
 vc->start(this->_ssl_ctx);
+vc->options.ip_proto  = NetVCOptions::USE_UDP;
+vc->options.ip_family = udpPacket->from.sa.sa_family;
+
 // TODO: Handle Connection ID of Client Cleartext / Non-Final Server 
Cleartext Packet
 this->_connections.put(qPkt->connection_id(), vc);
   }

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 03/05: Fix "Invalid argument" error on sending UDP packet

2017-08-17 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

commit 5fe89243e0d21d4cf0a1c268cb85ec7840f0198a
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Aug 18 14:35:57 2017 +0900

Fix "Invalid argument" error on sending UDP packet
---
 iocore/net/UnixUDPNet.cc | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/iocore/net/UnixUDPNet.cc b/iocore/net/UnixUDPNet.cc
index c6d4602..ee2c591 100644
--- a/iocore/net/UnixUDPNet.cc
+++ b/iocore/net/UnixUDPNet.cc
@@ -780,7 +780,7 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* 
pktLen ATS_UNUSED */)
   msg.msg_flags  = 0;
 #endif
   msg.msg_name= (caddr_t)>to.sa;
-  msg.msg_namelen = sizeof(p->to.sa);
+  msg.msg_namelen = ats_ip_size(p->to);
   iov_len = 0;
 
   for (IOBufferBlock *b = p->chain.get(); b != nullptr; b = b->next.get()) {
@@ -798,6 +798,10 @@ UDPQueue::SendUDPPacket(UDPPacketInternal *p, int32_t /* 
pktLen ATS_UNUSED */)
 n = ::sendmsg(p->conn->getFd(), , 0);
 if ((n >= 0) || ((n < 0) && (errno != EAGAIN))) {
   // send succeeded or some random error happened.
+  if (n < 0) {
+Debug("udp-send", "Error: %s (%d)", strerror(errno), errno);
+  }
+
   break;
 }
 if (errno == EAGAIN) {

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch quic-latest updated: Load TransportParameters from QUICConfig

2017-08-22 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 a4657c5  Load TransportParameters from QUICConfig
a4657c5 is described below

commit a4657c59fb7d2c1315ca09ecb2b3145c7168c5f2
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 09:11:26 2017 +0900

Load TransportParameters from QUICConfig
---
 iocore/net/QUICNetVConnection.cc | 18 +++---
 iocore/net/quic/QUICConfig.cc| 18 ++
 iocore/net/quic/QUICConfig.h |  9 -
 3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 7ae5251..d779a39 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -101,33 +101,37 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
   this->_frame_dispatcher =
 new QUICFrameDispatcher(this, this->_stream_manager, flowController, 
congestionController, this->_loss_detector);
 
-  // FIXME Fill appropriate values
+  QUICConfig::scoped_config params;
+
   // MUSTs
   QUICTransportParametersInEncryptedExtensions *tp = new 
QUICTransportParametersInEncryptedExtensions();
 
   size_t max_stream_data_buf_len = 4;
   ats_unique_buf max_stream_data_buf = 
ats_unique_malloc(max_stream_data_buf_len);
-  memcpy(max_stream_data_buf.get(), "\x00\x00\x00\x00", 
max_stream_data_buf_len);
+  QUICTypeUtil::write_uint_as_nbytes(params->initial_max_stream_data(), 
max_stream_data_buf_len, max_stream_data_buf.get(),
+ _stream_data_buf_len);
   tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA,
   std::unique_ptr(
 new QUICTransportParameterValue(std::move(max_stream_data_buf), 
max_stream_data_buf_len)));
 
   size_t max_data_buf_len = 4;
   ats_unique_buf max_data_buf = ats_unique_malloc(max_data_buf_len);
-  memcpy(max_data_buf.get(), "\x00\x00\x00\x00", max_data_buf_len);
+  QUICTypeUtil::write_uint_as_nbytes(params->initial_max_data(), 
max_data_buf_len, max_data_buf.get(), _data_buf_len);
   tp->add(QUICTransportParameterId::INITIAL_MAX_DATA,
   std::unique_ptr(new 
QUICTransportParameterValue(std::move(max_data_buf), max_data_buf_len)));
 
-  uint16_t max_stream_id_buf_len   = 4;
+  size_t max_stream_id_buf_len = 4;
   ats_unique_buf max_stream_id_buf = ats_unique_malloc(max_stream_id_buf_len);
-  memcpy(max_stream_id_buf.get(), "\x00\x00\x00\x00", max_stream_id_buf_len);
+  QUICTypeUtil::write_uint_as_nbytes(params->initial_max_stream_id(), 
max_stream_id_buf_len, max_stream_id_buf.get(),
+ _stream_id_buf_len);
   tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_ID,
   std::unique_ptr(
 new QUICTransportParameterValue(std::move(max_stream_id_buf), 
max_stream_id_buf_len)));
 
-  uint16_t idle_timeout_buf_len   = 2;
+  size_t idle_timeout_buf_len = 2;
   ats_unique_buf idle_timeout_buf = ats_unique_malloc(idle_timeout_buf_len);
-  memcpy(idle_timeout_buf.get(), "\x00\x00", idle_timeout_buf_len);
+  QUICTypeUtil::write_uint_as_nbytes(params->no_activity_timeout_in(), 
idle_timeout_buf_len, idle_timeout_buf.get(),
+ _timeout_buf_len);
   tp->add(QUICTransportParameterId::IDLE_TIMEOUT, 
std::unique_ptr(new QUICTransportParameterValue(
 
std::move(idle_timeout_buf), idle_timeout_buf_len)));
 
diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
index 64b8e90..d97ef54 100644
--- a/iocore/net/quic/QUICConfig.cc
+++ b/iocore/net/quic/QUICConfig.cc
@@ -42,6 +42,24 @@ QUICConfigParams::no_activity_timeout_in() const
   return this->_no_activity_timeout_in;
 }
 
+uint32_t
+QUICConfigParams::initial_max_data() const
+{
+  return this->_initial_max_data;
+}
+
+uint32_t
+QUICConfigParams::initial_max_stream_data() const
+{
+  return this->_initial_max_stream_data;
+}
+
+uint32_t
+QUICConfigParams::initial_max_stream_id() const
+{
+  return this->_initial_max_stream_id;
+}
+
 //
 // QUICConfig
 //
diff --git a/iocore/net/quic/QUICConfig.h b/iocore/net/quic/QUICConfig.h
index e4139bb..b9ac7c2 100644
--- a/iocore/net/quic/QUICConfig.h
+++ b/iocore/net/quic/QUICConfig.h
@@ -31,9 +31,16 @@ public:
   void initialize();
 
   uint32_t no_activity_timeout_in() const;
+  uint32_t initial_max_data() const;
+  uint32_t initial_max_stream_data() const;
+  uint32_t initial_max_stream_id() const;
 
 private:
-  uint32_t _no_activity_timeout_in = 0;
+  // FIXME Fill appropriate values
+  uint32_t _no_activity_timeout_in  = 0;
+  uint32_t _initial_max_data= 100; // in units of 1024 octets
+  uint32_t _initial_max_stream_data = 2048;

[trafficserver] 02/02: Fix QUICTransportParameter

2017-08-22 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

commit f98e16d6606509782ddb11dcf25797404aaccebd
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 08:40:53 2017 +0900

Fix QUICTransportParameter

- Make data of QUICTransportParameterValue std::unique_ptr
- Change _parameters table to std::map
- Fix binary format of TransportParameter
---
 iocore/net/QUICNetVConnection.cc   |  31 -
 iocore/net/quic/QUICTransportParameters.cc | 113 +++---
 iocore/net/quic/QUICTransportParameters.h  |  22 ++--
 .../net/quic/test/test_QUICTransportParameters.cc  | 132 ++---
 4 files changed, 195 insertions(+), 103 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 926c1d2..7ae5251 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -104,10 +104,33 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
   // FIXME Fill appropriate values
   // MUSTs
   QUICTransportParametersInEncryptedExtensions *tp = new 
QUICTransportParametersInEncryptedExtensions();
-  tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA, 
{reinterpret_cast("\x00\x00\x00\x00"), 4});
-  tp->add(QUICTransportParameterId::INITIAL_MAX_DATA, {reinterpret_cast("\x00\x00\x00\x00"), 4});
-  tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_ID, 
{reinterpret_cast("\x00\x00\x00\x00"), 4});
-  tp->add(QUICTransportParameterId::IDLE_TIMEOUT, {reinterpret_cast("\x00\x00"), 2});
+
+  size_t max_stream_data_buf_len = 4;
+  ats_unique_buf max_stream_data_buf = 
ats_unique_malloc(max_stream_data_buf_len);
+  memcpy(max_stream_data_buf.get(), "\x00\x00\x00\x00", 
max_stream_data_buf_len);
+  tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA,
+  std::unique_ptr(
+new QUICTransportParameterValue(std::move(max_stream_data_buf), 
max_stream_data_buf_len)));
+
+  size_t max_data_buf_len = 4;
+  ats_unique_buf max_data_buf = ats_unique_malloc(max_data_buf_len);
+  memcpy(max_data_buf.get(), "\x00\x00\x00\x00", max_data_buf_len);
+  tp->add(QUICTransportParameterId::INITIAL_MAX_DATA,
+  std::unique_ptr(new 
QUICTransportParameterValue(std::move(max_data_buf), max_data_buf_len)));
+
+  uint16_t max_stream_id_buf_len   = 4;
+  ats_unique_buf max_stream_id_buf = ats_unique_malloc(max_stream_id_buf_len);
+  memcpy(max_stream_id_buf.get(), "\x00\x00\x00\x00", max_stream_id_buf_len);
+  tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_ID,
+  std::unique_ptr(
+new QUICTransportParameterValue(std::move(max_stream_id_buf), 
max_stream_id_buf_len)));
+
+  uint16_t idle_timeout_buf_len   = 2;
+  ats_unique_buf idle_timeout_buf = ats_unique_malloc(idle_timeout_buf_len);
+  memcpy(idle_timeout_buf.get(), "\x00\x00", idle_timeout_buf_len);
+  tp->add(QUICTransportParameterId::IDLE_TIMEOUT, 
std::unique_ptr(new QUICTransportParameterValue(
+
std::move(idle_timeout_buf), idle_timeout_buf_len)));
+
   tp->add_version(QUIC_SUPPORTED_VERSIONS[0]);
   // MAYs
   // 
this->_local_transport_parameters.add(QUICTransportParameterId::TRUNCATE_CONNECTION_ID,
 {});
diff --git a/iocore/net/quic/QUICTransportParameters.cc 
b/iocore/net/quic/QUICTransportParameters.cc
index fe0d0d8..c8638c4 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -35,35 +35,59 @@ QUICTransportParameters::QUICTransportParameters(const 
uint8_t *buf, size_t len)
   memcpy(this->_buf.get(), buf, len);
 }
 
-QUICTransportParameterValue
-QUICTransportParameters::get(QUICTransportParameterId tpid) const
+const uint8_t *
+QUICTransportParameters::get(QUICTransportParameterId tpid, uint16_t ) 
const
 {
-  QUICTransportParameterValue value;
-  const uint8_t *p = this->_buf.get() + this->_parameters_offset();
+  if (this->_buf) {
+const uint8_t *p = this->_buf.get() + this->_parameters_offset();
 
-  uint16_t n = (p[0] << 8) + p[1];
-  p += 2;
-  for (; n > 0; --n) {
-uint16_t _id = (p[0] << 8) + p[1];
-p += 2;
-uint16_t _value_len = (p[0] << 8) + p[1];
+uint16_t n = (p[0] << 8) + p[1];
 p += 2;
-if (tpid == _id) {
-  value.data = p;
-  value.len  = _value_len;
-  return value;
+for (; n > 0; --n) {
+  uint16_t _id = (p[0] << 8) + p[1];
+  p += 2;
+  uint16_t _value_len = (p[0] << 8) + p[1];
+  p += 2;
+  if (tpid == _id) {
+len = _value_len;
+return p;
+  }
+  p += _value_len;
+}
+  } else {
+auto p = 
this->_parameters.find(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA);
+   

[trafficserver] 01/02: Fix build error of test_QUICStream

2017-08-22 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

commit 6115406298e96219ab1a20e671094c52f5dea760
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 08:34:07 2017 +0900

Fix build error of test_QUICStream
---
 iocore/net/quic/test/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index 3d43c16..c09f670 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -215,6 +215,7 @@ test_QUICStream_SOURCES = \
   ../QUICFrameDispatcher.cc \
   ../QUICStreamManager.cc \
   ../QUICFlowController.cc \
+  ../QUICApplicationMap.cc \
   ../QUICCongestionController.cc
 
 test_QUICStream_LDADD = \

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch quic-latest updated (cd36a9e -> f98e16d)

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

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


from cd36a9e  Add QUICApplicatioMap
 new 6115406  Fix build error of test_QUICStream
 new f98e16d  Fix QUICTransportParameter

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/QUICNetVConnection.cc   |  31 -
 iocore/net/quic/QUICTransportParameters.cc | 113 +++---
 iocore/net/quic/QUICTransportParameters.h  |  22 ++--
 iocore/net/quic/test/Makefile.am   |   1 +
 .../net/quic/test/test_QUICTransportParameters.cc  | 132 ++---
 5 files changed, 196 insertions(+), 103 deletions(-)

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


[trafficserver] branch quic-latest updated: Cleanup QUICTransportParameterValue

2017-08-22 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 a86fca0  Cleanup QUICTransportParameterValue
a86fca0 is described below

commit a86fca03b73533a4bcdfc2f58e9bd17413791a9f
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 10:37:54 2017 +0900

Cleanup QUICTransportParameterValue
---
 iocore/net/QUICNetVConnection.cc   | 29 -
 iocore/net/quic/QUICTransportParameters.cc | 49 +++---
 iocore/net/quic/QUICTransportParameters.h  | 21 ++
 .../net/quic/test/test_QUICTransportParameters.cc  | 44 ---
 4 files changed, 81 insertions(+), 62 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index d841232..3fc88e0 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -110,34 +110,19 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
   // MUSTs
   QUICTransportParametersInEncryptedExtensions *tp = new 
QUICTransportParametersInEncryptedExtensions();
 
-  size_t max_stream_data_buf_len = 4;
-  ats_unique_buf max_stream_data_buf = 
ats_unique_malloc(max_stream_data_buf_len);
-  QUICTypeUtil::write_uint_as_nbytes(params->initial_max_stream_data(), 
max_stream_data_buf_len, max_stream_data_buf.get(),
- _stream_data_buf_len);
   tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA,
   std::unique_ptr(
-new QUICTransportParameterValue(std::move(max_stream_data_buf), 
max_stream_data_buf_len)));
-
-  size_t max_data_buf_len = 4;
-  ats_unique_buf max_data_buf = ats_unique_malloc(max_data_buf_len);
-  QUICTypeUtil::write_uint_as_nbytes(params->initial_max_data(), 
max_data_buf_len, max_data_buf.get(), _data_buf_len);
-  tp->add(QUICTransportParameterId::INITIAL_MAX_DATA,
-  std::unique_ptr(new 
QUICTransportParameterValue(std::move(max_data_buf), max_data_buf_len)));
-
-  size_t max_stream_id_buf_len = 4;
-  ats_unique_buf max_stream_id_buf = ats_unique_malloc(max_stream_id_buf_len);
-  QUICTypeUtil::write_uint_as_nbytes(params->initial_max_stream_id(), 
max_stream_id_buf_len, max_stream_id_buf.get(),
- _stream_id_buf_len);
+new QUICTransportParameterValue(params->initial_max_stream_data(), 
sizeof(params->initial_max_stream_data();
+
+  tp->add(QUICTransportParameterId::INITIAL_MAX_DATA, 
std::unique_ptr(new QUICTransportParameterValue(
+
params->initial_max_data(), sizeof(params->initial_max_data();
+
   tp->add(QUICTransportParameterId::INITIAL_MAX_STREAM_ID,
   std::unique_ptr(
-new QUICTransportParameterValue(std::move(max_stream_id_buf), 
max_stream_id_buf_len)));
+new QUICTransportParameterValue(params->initial_max_stream_id(), 
sizeof(params->initial_max_stream_id();
 
-  size_t idle_timeout_buf_len = 2;
-  ats_unique_buf idle_timeout_buf = ats_unique_malloc(idle_timeout_buf_len);
-  QUICTypeUtil::write_uint_as_nbytes(params->no_activity_timeout_in(), 
idle_timeout_buf_len, idle_timeout_buf.get(),
- _timeout_buf_len);
   tp->add(QUICTransportParameterId::IDLE_TIMEOUT, 
std::unique_ptr(new QUICTransportParameterValue(
-
std::move(idle_timeout_buf), idle_timeout_buf_len)));
+
params->no_activity_timeout_in(), sizeof(uint16_t;
 
   tp->add_version(QUIC_SUPPORTED_VERSIONS[0]);
   // MAYs
diff --git a/iocore/net/quic/QUICTransportParameters.cc 
b/iocore/net/quic/QUICTransportParameters.cc
index c8638c4..7365084 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -29,6 +29,35 @@
 
 const static int TRANSPORT_PARAMETERS_MAXIMUM_SIZE = 65535;
 
+//
+// QUICTransportParameterValue
+//
+QUICTransportParameterValue::QUICTransportParameterValue(ats_unique_buf d, 
uint16_t l) : _data(std::move(d)), _len(l){};
+
+QUICTransportParameterValue::QUICTransportParameterValue(uint64_t raw_data, 
uint16_t l)
+{
+  this->_data = ats_unique_malloc(l);
+  size_t len  = 0;
+  QUICTypeUtil::write_uint_as_nbytes(raw_data, l, this->_data.get(), );
+  this->_len = len;
+};
+
+const uint8_t *
+QUICTransportParameterValue::data() const
+{
+  return this->_data.get();
+}
+
+uint16_t
+QUICTransportParameterValue::len() const
+{
+  return this->_len;
+}
+
+//
+// QUICTransportParameters
+//
+
 QUICTransportParameters::QUICTransportParameters(const uint8_t *buf, size_t 
len)
 {
   this->_buf = ats_unique_malloc(len);
@@ -57,8 +86,8 @@ QUICTransportParameters::g

[trafficserver] 02/02: Add Flow Control support

2017-08-22 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

commit 08f2639c08f722660317b95f0c6d9116cb01f5ac
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 11:47:56 2017 +0900

Add Flow Control support
---
 iocore/net/P_QUICNetVConnection.h   |   5 +-
 iocore/net/QUICNetVConnection.cc|   9 +-
 iocore/net/quic/Mock.h  |  10 ++
 iocore/net/quic/QUICConnection.h|   1 +
 iocore/net/quic/QUICStream.cc   | 128 +++--
 iocore/net/quic/QUICStream.h|  17 +++-
 iocore/net/quic/QUICStreamManager.cc| 164 ++--
 iocore/net/quic/QUICStreamManager.h |  30 +-
 iocore/net/quic/QUICTypes.h |  71 --
 iocore/net/quic/test/test_QUICStream.cc |   8 +-
 10 files changed, 408 insertions(+), 35 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index d42c63d..b4e07de 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -168,6 +168,7 @@ public:
   uint32_t pmtu() override;
   void set_transport_parameters(std::unique_ptr tp) 
override;
   const QUICTransportParameters _transport_parameters() override;
+  const QUICTransportParameters _transport_parameters() override;
   void close(QUICError error) override;
 
   // QUICConnection (QUICPacketTransmitter)
@@ -193,8 +194,8 @@ private:
 
   uint32_t _pmtu = 1280;
 
-  std::unique_ptr _local_transport_parameters;
-  std::unique_ptr _remote_transport_parameters;
+  std::unique_ptr _local_transport_parameters  = 
nullptr;
+  std::unique_ptr _remote_transport_parameters = 
nullptr;
 
   // TODO: use custom allocator and make them std::unique_ptr or 
std::shared_ptr
   // or make them just member variables.
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 3fc88e0..7e92e60 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -94,7 +94,7 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
 
   // Create frame handlers
   this->_stream_manager = new QUICStreamManager();
-  this->_stream_manager->init(this, >_application_map);
+  this->_stream_manager->init(this, this, >_application_map);
   this->_flow_controller   = new QUICFlowController();
   this->_congestion_controller = new QUICCongestionController();
   this->_loss_detector = new QUICLossDetector(this);
@@ -174,6 +174,7 @@ void
 
QUICNetVConnection::set_transport_parameters(std::unique_ptr
 tp)
 {
   this->_remote_transport_parameters = std::move(tp);
+  
this->_stream_manager->init_flow_control_params(*this->_local_transport_parameters,
 *this->_remote_transport_parameters);
 
   const QUICTransportParametersInClientHello *tp_in_ch =
 dynamic_cast(this->_remote_transport_parameters.get());
@@ -212,6 +213,12 @@ QUICNetVConnection::local_transport_parameters()
   return *this->_local_transport_parameters;
 }
 
+const QUICTransportParameters &
+QUICNetVConnection::remote_transport_parameters()
+{
+  return *this->_remote_transport_parameters;
+}
+
 uint32_t
 QUICNetVConnection::minimum_quic_packet_size()
 {
diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 7848e5b..195b285 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -169,6 +169,12 @@ public:
 return dummy_transport_parameters;
   }
 
+  const QUICTransportParameters &
+  remote_transport_parameters() override
+  {
+return dummy_transport_parameters;
+  }
+
   void
   close(QUICError error) override
   {
@@ -285,6 +291,10 @@ public:
 return _totalFrameCount;
   }
 
+  bool is_recv_avail_more_than(uint64_t /* size */) override { return true; }
+
+  void send_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> /* frame 
*/) override { return; }
+
 private:
   int _totalFrameCount = 0;
   int _frameCount[256] = {0};
diff --git a/iocore/net/quic/QUICConnection.h b/iocore/net/quic/QUICConnection.h
index a90b73f..9aad687 100644
--- a/iocore/net/quic/QUICConnection.h
+++ b/iocore/net/quic/QUICConnection.h
@@ -38,5 +38,6 @@ public:
   virtual uint32_t pmtu()  
  = 0;
   virtual void 
set_transport_parameters(std::unique_ptr tp) = 0;
   virtual const QUICTransportParameters _transport_parameters()  
  = 0;
+  virtual const QUICTransportParameters _transport_parameters() 
  = 0;
   virtual void close(QUICError error)  
  = 0;
 };
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 8a10c57..3623377 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -26,15 +26,21 @@
 #include "I_Event.h"
 #include "QUICStreamManager.h"

[trafficserver] branch quic-latest updated (a86fca0 -> 08f2639)

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

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


from a86fca0  Cleanup QUICTransportParameterValue
 new 1d28d8c  Rename _request/_response_buffer_offset to _recv/_send_offset
 new 08f2639  Add Flow Control support

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/P_QUICNetVConnection.h   |   5 +-
 iocore/net/QUICNetVConnection.cc|   9 +-
 iocore/net/quic/Mock.h  |  10 ++
 iocore/net/quic/QUICConnection.h|   1 +
 iocore/net/quic/QUICStream.cc   | 144 +---
 iocore/net/quic/QUICStream.h|  24 -
 iocore/net/quic/QUICStreamManager.cc| 164 ++--
 iocore/net/quic/QUICStreamManager.h |  30 +-
 iocore/net/quic/QUICTypes.h |  71 --
 iocore/net/quic/test/test_QUICStream.cc |   8 +-
 10 files changed, 422 insertions(+), 44 deletions(-)

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


[trafficserver] 01/02: Rename _request/_response_buffer_offset to _recv/_send_offset

2017-08-22 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

commit 1d28d8c41ca04d8e97e8c49d5710dd1ee240ddba
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 12:10:56 2017 +0900

Rename _request/_response_buffer_offset to _recv/_send_offset
---
 iocore/net/quic/QUICStream.cc | 20 
 iocore/net/quic/QUICStream.h  |  7 ---
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index edd19ea..8a10c57 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -229,16 +229,16 @@ QUICStream::_write_to_read_vio(std::shared_ptr frame)
 
   int bytes_added = this->_read_vio.buffer.writer()->write(frame->data(), 
frame->data_length());
   this->_read_vio.nbytes += bytes_added;
-  this->_request_buffer_offset += frame->data_length();
+  this->_recv_offset += frame->data_length();
 }
 
 void
 QUICStream::_reorder_data()
 {
-  auto frame = _request_stream_frame_buffer.find(this->_request_buffer_offset);
+  auto frame = _request_stream_frame_buffer.find(this->_recv_offset);
   while (frame != this->_request_stream_frame_buffer.end()) {
 this->_write_to_read_vio(frame->second);
-frame = _request_stream_frame_buffer.find(this->_request_buffer_offset);
+frame = _request_stream_frame_buffer.find(this->_recv_offset);
   }
 }
 
@@ -260,10 +260,14 @@ QUICStream::recv(std::shared_ptr 
frame)
   }
   this->_state.update_with_received_frame(*frame);
 
-  if (this->_request_buffer_offset > frame->offset()) {
+  if (frame->offset() > this->_recv_largest_offset) {
+this->_recv_largest_offset = frame->offset();
+  }
+
+  if (this->_recv_offset > frame->offset()) {
 // Do nothing. Just ignore STREAM frame.
 return;
-  } else if (this->_request_buffer_offset == frame->offset()) {
+  } else if (this->_recv_offset == frame->offset()) {
 this->_write_to_read_vio(frame);
 this->_reorder_data();
   } else {
@@ -298,10 +302,10 @@ QUICStream::_send()
   len = data_len;
 }
 
-std::unique_ptr<QUICStreamFrame, QUICFrameDeleterFunc> frame = 
QUICFrameFactory::create_stream_frame(
-  reinterpret_cast(reader->start()), len, this->_id, 
this->_response_buffer_offset);
+std::unique_ptr<QUICStreamFrame, QUICFrameDeleterFunc> frame =
+  QUICFrameFactory::create_stream_frame(reinterpret_cast(reader->start()), len, this->_id, this->_send_offset);
 
-this->_response_buffer_offset += len;
+this->_send_offset += len;
 reader->consume(len);
 this->_write_vio.ndone += len;
 total_len += len;
diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h
index aeb5d65..1992d21 100644
--- a/iocore/net/quic/QUICStream.h
+++ b/iocore/net/quic/QUICStream.h
@@ -81,9 +81,10 @@ private:
 
   Event *_send_tracked_event(Event *event, int send_event, VIO *vio);
 
-  QUICStreamId _id   = 0;
-  QUICOffset _request_buffer_offset  = 0;
-  QUICOffset _response_buffer_offset = 0;
+  QUICStreamId _id= 0;
+  QUICOffset _recv_offset = 0;
+  QUICOffset _recv_largest_offset = 0;
+  QUICOffset _send_offset = 0;
 
   VIO _read_vio;
   VIO _write_vio;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 02/02: Cleanup QUICStreamManager

2017-08-23 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

commit 075d829b405800c70061797725a5584d378f48ab
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 16:35:10 2017 +0900

Cleanup QUICStreamManager
---
 iocore/net/quic/QUICStream.cc|  2 +-
 iocore/net/quic/QUICStreamManager.cc | 18 +-
 iocore/net/quic/QUICStreamManager.h  | 10 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 3623377..f559419 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -400,7 +400,7 @@ QUICStream::_send()
   break;
 }
 this->_state.update_with_sent_frame(*frame);
-this->_streamManager->send_stream_frame(std::move(frame));
+this->_streamManager->send_frame(std::move(frame));
   }
 
   return;
diff --git a/iocore/net/quic/QUICStreamManager.cc 
b/iocore/net/quic/QUICStreamManager.cc
index 6015f39..4ac3b94 100644
--- a/iocore/net/quic/QUICStreamManager.cc
+++ b/iocore/net/quic/QUICStreamManager.cc
@@ -68,7 +68,7 @@ QUICStreamManager::handle_frame(std::shared_ptr frame)
 
   switch (frame->type()) {
   case QUICFrameType::MAX_DATA: {
-error = this->_handle_max_data_frame(std::dynamic_pointer_cast(frame));
+error = this->_handle_frame(std::dynamic_pointer_cast(frame));
 break;
   }
   case QUICFrameType::BLOCKED: {
@@ -76,15 +76,15 @@ QUICStreamManager::handle_frame(std::shared_ptr frame)
 break;
   }
   case QUICFrameType::MAX_STREAM_DATA: {
-error = 
this->_handle_max_stream_data_frame(std::dynamic_pointer_cast(frame));
+error = this->_handle_frame(std::dynamic_pointer_cast(frame));
 break;
   }
   case QUICFrameType::STREAM_BLOCKED: {
-error = this->_handle_stream_blocked_frame(std::dynamic_pointer_cast(frame));
+error = this->_handle_frame(std::dynamic_pointer_cast(frame));
 break;
   }
   case QUICFrameType::STREAM:
-error = this->_handle_stream_frame(std::dynamic_pointer_cast(frame));
+error = this->_handle_frame(std::dynamic_pointer_cast(frame));
 break;
   default:
 Debug(tag, "Unexpected frame type: %02x", static_cast(frame->type()));
@@ -96,7 +96,7 @@ QUICStreamManager::handle_frame(std::shared_ptr frame)
 }
 
 QUICError
-QUICStreamManager::_handle_max_data_frame(std::shared_ptr frame)
+QUICStreamManager::_handle_frame(std::shared_ptr frame)
 {
   this->_send_max_data = frame->maximum_data();
   return QUICError(QUICErrorClass::NONE);
@@ -111,7 +111,7 @@ QUICStreamManager::slide_recv_max_data()
 }
 
 QUICError
-QUICStreamManager::_handle_max_stream_data_frame(std::shared_ptr frame)
+QUICStreamManager::_handle_frame(std::shared_ptr 
frame)
 {
   QUICStream *stream = this->_find_stream(frame->stream_id());
   if (stream) {
@@ -124,7 +124,7 @@ 
QUICStreamManager::_handle_max_stream_data_frame(std::shared_ptr frame)
+QUICStreamManager::_handle_frame(std::shared_ptr 
frame)
 {
   QUICStream *stream = this->_find_stream(frame->stream_id());
   if (stream) {
@@ -137,7 +137,7 @@ 
QUICStreamManager::_handle_stream_blocked_frame(std::shared_ptr 
frame)
+QUICStreamManager::_handle_frame(std::shared_ptr frame)
 {
   QUICStream *stream   = 
this->_find_or_create_stream(frame->stream_id());
   QUICApplication *application = this->_app_map->get(frame->stream_id());
@@ -159,7 +159,7 @@ 
QUICStreamManager::_handle_stream_frame(std::shared_ptr f
  * @brief Send stream frame
  */
 void
-QUICStreamManager::send_stream_frame(std::unique_ptr<QUICStreamFrame, 
QUICFrameDeleterFunc> frame)
+QUICStreamManager::send_frame(std::unique_ptr<QUICStreamFrame, 
QUICFrameDeleterFunc> frame)
 {
   // XXX The offset of sending frame is always largest offset by sending side
   if (frame->stream_id() != STREAM_ID_FOR_HANDSHAKE) {
diff --git a/iocore/net/quic/QUICStreamManager.h 
b/iocore/net/quic/QUICStreamManager.h
index 4abea4f..fbfc6e9 100644
--- a/iocore/net/quic/QUICStreamManager.h
+++ b/iocore/net/quic/QUICStreamManager.h
@@ -41,7 +41,7 @@ public:
   virtual std::vector interests() override;
   virtual QUICError handle_frame(std::shared_ptr) override;
   virtual void send_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> 
frame);
-  void send_stream_frame(std::unique_ptr<QUICStreamFrame, 
QUICFrameDeleterFunc> frame);
+  virtual void send_frame(std::unique_ptr<QUICStreamFrame, 
QUICFrameDeleterFunc> frame);
   virtual bool is_send_avail_more_than(uint64_t size);
   virtual bool is_recv_avail_more_than(uint64_t size);
   void add_recv_total_offset(uint64_t delta);
@@ -57,10 +57,10 @@ public:
 private:
   QUICStream *_find_or_create_stream(QUICStreamId stream_id);
   QUICStream *_find_stream(QUICStreamId id);
-  QUICError _handle_max_data_frame(s

[trafficserver] branch quic-latest updated (6d538d4 -> 075d829)

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

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


from 6d538d4  Return QUICError from QUICFrameHandler::handle_frame()
 new 0b58990  Remvoe duplicated mutex allocation
 new 075d829  Cleanup QUICStreamManager

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/QUICNetVConnection.cc |  1 -
 iocore/net/quic/QUICStream.cc|  2 +-
 iocore/net/quic/QUICStreamManager.cc | 18 +-
 iocore/net/quic/QUICStreamManager.h  | 10 +-
 4 files changed, 15 insertions(+), 16 deletions(-)

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


[trafficserver] 01/02: Remvoe duplicated mutex allocation

2017-08-23 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

commit 0b589903df5f433fc44df2c408eb30428c13de99
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 16:25:45 2017 +0900

Remvoe duplicated mutex allocation
---
 iocore/net/QUICNetVConnection.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index f6343c3..3ec81cb 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -62,7 +62,6 @@ QUICNetVConnection::init(UDPConnection *udp_con, 
QUICPacketHandler *packet_handl
 {
   this->_transmitter_mutex = new_ProxyMutex();
   this->_udp_con   = udp_con;
-  this->_transmitter_mutex = new_ProxyMutex();
   this->_packet_handler= packet_handler;
   this->_quic_connection_id.randomize();
 

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] branch quic-latest updated: Delete QUICFlowController class

2017-08-22 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 970d637  Delete QUICFlowController class
970d637 is described below

commit 970d63786d0711ecf283f7d719a9b5f725c42caf
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 14:58:04 2017 +0900

Delete QUICFlowController class
---
 iocore/net/P_QUICNetVConnection.h|  2 -
 iocore/net/QUICNetVConnection.cc |  3 --
 iocore/net/quic/Makefile.am  |  1 -
 iocore/net/quic/Mock.h   | 44 --
 iocore/net/quic/QUICFlowController.cc| 48 
 iocore/net/quic/QUICFlowController.h | 37 --
 iocore/net/quic/QUICFrameDispatcher.cc   |  1 -
 iocore/net/quic/test/Makefile.am |  2 -
 iocore/net/quic/test/test_QUICFrameDispatcher.cc |  5 ---
 9 files changed, 143 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index b4e07de..8e5586c 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -54,7 +54,6 @@
 #include "quic/QUICAckFrameCreator.h"
 #include "quic/QUICLossDetector.h"
 #include "quic/QUICStreamManager.h"
-#include "quic/QUICFlowController.h"
 #include "quic/QUICCongestionController.h"
 #include "quic/QUICApplicationMap.h"
 
@@ -205,7 +204,6 @@ private:
   QUICLossDetector *_loss_detector = nullptr;
   QUICFrameDispatcher *_frame_dispatcher   = nullptr;
   QUICStreamManager *_stream_manager   = nullptr;
-  QUICFlowController *_flow_controller = nullptr;
   QUICCongestionController *_congestion_controller = nullptr;
 
   Queue _packet_recv_queue;
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 7e92e60..e34f13c 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -95,13 +95,11 @@ QUICNetVConnection::start(SSL_CTX *ssl_ctx)
   // Create frame handlers
   this->_stream_manager = new QUICStreamManager();
   this->_stream_manager->init(this, this, >_application_map);
-  this->_flow_controller   = new QUICFlowController();
   this->_congestion_controller = new QUICCongestionController();
   this->_loss_detector = new QUICLossDetector(this);
 
   this->_frame_dispatcher->add_handler(this);
   this->_frame_dispatcher->add_handler(this->_stream_manager);
-  this->_frame_dispatcher->add_handler(this->_flow_controller);
   this->_frame_dispatcher->add_handler(this->_congestion_controller);
   this->_frame_dispatcher->add_handler(this->_loss_detector);
 
@@ -145,7 +143,6 @@ QUICNetVConnection::free(EThread *t)
   delete this->_loss_detector;
   delete this->_frame_dispatcher;
   delete this->_stream_manager;
-  delete this->_flow_controller;
   delete this->_congestion_controller;
 
   // TODO: clear member variables like `UnixNetVConnection::free(EThread *t)`
diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index 9d0ae8d..fda10cd 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -48,7 +48,6 @@ libquic_a_SOURCES = \
   QUICVersionNegotiator.cc \
   QUICLossDetector.cc \
   QUICStreamManager.cc \
-  QUICFlowController.cc \
   QUICCongestionController.cc \
   QUICStreamState.cc \
   QUICStream.cc \
diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h
index 195b285..b697954 100644
--- a/iocore/net/quic/Mock.h
+++ b/iocore/net/quic/Mock.h
@@ -22,7 +22,6 @@
  */
 
 #include "QUICStreamManager.h"
-#include "QUICFlowController.h"
 #include "QUICCongestionController.h"
 #include "QUICLossDetector.h"
 #include "QUICEvents.h"
@@ -343,49 +342,6 @@ private:
   int _frameCount[256] = {0};
 };
 
-class MockQUICFlowController : public QUICFlowController
-{
-public:
-  MockQUICFlowController() {}
-
-  // Override
-  virtual void
-  handle_frame(std::shared_ptr f) override
-  {
-++_frameCount[static_cast(f->type())];
-++_totalFrameCount;
-  }
-
-  // for Test
-  int
-  getStreamFrameCount()
-  {
-return _frameCount[static_cast(QUICFrameType::STREAM)];
-  }
-
-  int
-  getAckFrameCount()
-  {
-return _frameCount[static_cast(QUICFrameType::ACK)];
-  }
-
-  int
-  getPingFrameCount()
-  {
-return _frameCount[static_cast(QUICFrameType::PING)];
-  }
-
-  int
-  getTotalFrameCount()
-  {
-return _totalFrameCount;
-  }
-
-private:
-  int _totalFrameCount = 0;
-  int _frameCount[256] = {0};
-};
-
 void NetVConnection::cancel_OOB(){};
 Action *
 NetVConnection::send_OOB(Continuation *, char *, int)
diff --git a/i

[trafficserver] branch quic-latest updated: Return QUICError from QUICFrameHandler::handle_frame()

2017-08-23 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 6d538d4  Return QUICError from QUICFrameHandler::handle_frame()
6d538d4 is described below

commit 6d538d4e4cb385325999150e67c0b1848aca6997
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Aug 23 16:05:01 2017 +0900

Return QUICError from QUICFrameHandler::handle_frame()
---
 iocore/net/P_QUICNetVConnection.h|  4 +-
 iocore/net/QUICNetVConnection.cc | 65 ++--
 iocore/net/quic/Mock.h   | 12 +++--
 iocore/net/quic/QUICCongestionController.cc  |  6 ++-
 iocore/net/quic/QUICCongestionController.h   |  2 +-
 iocore/net/quic/QUICFrameDispatcher.cc   | 18 ---
 iocore/net/quic/QUICFrameDispatcher.h|  2 +-
 iocore/net/quic/QUICFrameHandler.h   |  4 +-
 iocore/net/quic/QUICLossDetector.cc  |  6 ++-
 iocore/net/quic/QUICLossDetector.h   |  2 +-
 iocore/net/quic/QUICStreamManager.cc |  6 +--
 iocore/net/quic/QUICStreamManager.h  |  2 +-
 iocore/net/quic/test/test_QUICFrameDispatcher.cc |  5 +-
 13 files changed, 83 insertions(+), 51 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index a2e6cf3..6d70c00 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -185,7 +185,7 @@ public:
 
   // QUICConnection (QUICFrameHandler)
   std::vector interests() override;
-  void handle_frame(std::shared_ptr frame) override;
+  QUICError handle_frame(std::shared_ptr frame) override;
 
 private:
   QUICConnectionId _quic_connection_id;
@@ -221,7 +221,7 @@ private:
   std::unique_ptr _build_packet(ats_unique_buf buf, size_t len, 
bool retransmittable,
 QUICPacketType type = 
QUICPacketType::UNINITIALIZED);
 
-  void _recv_and_ack(const uint8_t *payload, uint16_t size, QUICPacketNumber 
packet_num);
+  QUICError _recv_and_ack(const uint8_t *payload, uint16_t size, 
QUICPacketNumber packet_numm);
 
   QUICError 
_state_handshake_process_initial_client_packet(std::unique_ptr packet);
   QUICError 
_state_handshake_process_client_cleartext_packet(std::unique_ptr packet);
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 1d44f42..f6343c3 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -322,9 +322,11 @@ QUICNetVConnection::interests()
   return {QUICFrameType::CONNECTION_CLOSE};
 }
 
-void
+QUICError
 QUICNetVConnection::handle_frame(std::shared_ptr frame)
 {
+  QUICError error = QUICError(QUICErrorClass::NONE);
+
   switch (frame->type()) {
   case QUICFrameType::CONNECTION_CLOSE:
 DebugQUICCon("Enter state_connection_closed");
@@ -335,6 +337,8 @@ QUICNetVConnection::handle_frame(std::shared_ptr frame)
 ink_assert(false);
 break;
   }
+
+  return error;
 }
 
 // TODO: Timeout by active_timeout / inactive_timeout
@@ -542,26 +546,30 @@ 
QUICNetVConnection::_state_handshake_process_initial_client_packet(std::unique_p
 if (packet->type() != QUICPacketType::CLIENT_INITIAL) {
   return QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
 }
-if (packet->version()) {
-  if (this->_version_negotiator->negotiate(packet.get()) == 
QUICVersionNegotiationStatus::NEGOTIATED) {
-DebugQUICCon("Version negotiation succeeded: %x", packet->version());
-this->_packet_factory.set_version(packet->version());
-// Check integrity (QUIC-TLS-04: 6.1. Integrity Check Processing)
-if (packet->has_valid_fnv1a_hash()) {
-  // Version 0x0001 uses stream 0 for cryptographic handshake with 
TLS 1.3, but newer version may not
-  this->_handshake_handler = new QUICHandshake(this, this->_crypto);
-  this->_application_map.set(STREAM_ID_FOR_HANDSHAKE, 
this->_handshake_handler);
-
-  this->_frame_dispatcher->receive_frames(packet->payload(), 
packet->payload_size());
-} else {
-  DebugQUICCon("Invalid FNV-1a hash value");
-}
-  } else {
-DebugQUICCon("Version negotiation failed: %x", packet->version());
-  }
-} else {
+
+if (!packet->version()) {
   return QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
 }
+
+if (this->_version_negotiator->negotiate(packet.get()) != 
QUICVersionNegotiationStatus::NEGOTIATED) {
+  DebugQUICCon("Version negotiation failed: %x", packet->version());
+  return QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_VERSION_NEGOTIATION_MISMATCH);

[trafficserver] branch master updated: Fix handling read errors in TLS Handshake

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

masaori 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 b3c5909  Fix handling read errors in TLS Handshake
b3c5909 is described below

commit b3c59095fa9cd1503ab552b72283b52c32dfb577
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Jun 7 12:39:54 2017 +0900

Fix handling read errors in TLS Handshake
---
 iocore/net/SSLNetVConnection.cc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index da5af65..b0cc8fd 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -351,10 +351,12 @@ SSLNetVConnection::read_raw_data()
   // If we have already moved some bytes successfully, adjust total_read to 
reflect reality
   // If any read succeeded, we should return success
   if (r != rattempted) {
-if (r <= 0)
+// If the first read failds, we should return error
+if (r <= 0 && total_read > rattempted) {
   r = total_read - rattempted;
-else
+} else {
   r = total_read - rattempted + r;
+}
   }
   NET_SUM_DYN_STAT(net_read_bytes_stat, r);
 

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


[trafficserver] branch master updated: Coverity 1373300: Use of untrusted scalar value

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

masaori 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  f45e257   Coverity 1373300: Use of untrusted scalar value
f45e257 is described below

commit f45e2574d6a298a962e1f032f5855179ee1295c3
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue May 30 11:38:14 2017 +0900

Coverity 1373300: Use of untrusted scalar value
---
 proxy/http2/Http2ConnectionState.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/http2/Http2ConnectionState.h 
b/proxy/http2/Http2ConnectionState.h
index 8942065..3ba9af4 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -81,7 +81,7 @@ public:
   unsigned
   set(Http2SettingsIdentifier id, unsigned value)
   {
-if (id < HTTP2_SETTINGS_MAX) {
+if (0 < id && id < HTTP2_SETTINGS_MAX) {
   return this->settings[indexof(id)] = value;
 } else {
   ink_assert(!"Bad Settings Identifier");

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


[trafficserver] branch master updated: Add range check of Http2SettingsIdentifier

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

masaori 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  c2bc17d   Add range check of Http2SettingsIdentifier
c2bc17d is described below

commit c2bc17d665ccd70e7e33ca3c456f2e4146ea20a6
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue May 30 15:50:02 2017 +0900

Add range check of Http2SettingsIdentifier
---
 proxy/http2/Http2ConnectionState.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.h 
b/proxy/http2/Http2ConnectionState.h
index 3ba9af4..05e9895 100644
--- a/proxy/http2/Http2ConnectionState.h
+++ b/proxy/http2/Http2ConnectionState.h
@@ -69,7 +69,7 @@ public:
   unsigned
   get(Http2SettingsIdentifier id) const
   {
-if (id < HTTP2_SETTINGS_MAX) {
+if (0 < id && id < HTTP2_SETTINGS_MAX) {
   return this->settings[indexof(id)];
 } else {
   ink_assert(!"Bad Settings Identifier");
@@ -95,7 +95,7 @@ private:
   static unsigned
   indexof(Http2SettingsIdentifier id)
   {
-ink_assert(id < HTTP2_SETTINGS_MAX);
+ink_assert(0 < id && id < HTTP2_SETTINGS_MAX);
 
 return id - 1;
   }

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


[trafficserver] branch maskit/quic deleted (was 5022022)

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

masaori pushed a change to branch maskit/quic
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


 was 5022022  Cleanup QUICStream

This change permanently discards the following revisions:

 discard 5022022  Cleanup QUICStream
 discard 3f61d3a  Add tests for QUICStream and fix bug
 discard 5ebd73f  Add test of QUICPacket::payload_size()
 discard 39ac776  Fix QUICPacket test
 discard 9f1c05a  Add quic/Makefile.am
 discard 9c5be30  Rename read_signal/write_signal to 
trigger_read_event/trigger_write_event
 discard 5f192f9  Use read_vio/write_vio of QUICStream
 discard a0294d3  Add QUICPacket::payload_size()
 discard f233661  Change pSendQueue to Queue
 discard a63ade2  Fix Makefile.am
 discard 45c6f2f  Use QUICPacket and QUICFrame
 discard 16a154c  Add test_QUICFrameHandler
 discard 0d0991e  Add QUICFrame
 discard 9307c87  clang-format
 discard 1f5c7ed  Fix warnings
 discard 37d385f  Rename proxy/quic to proxy/hq
 discard e3d0c5d  Rebased latest master and remove QUICProxyClientSession
 discard 8c43ef7  Rename QUICNetAccept to QUICPacketHandler
 discard 15dbbf1  Change class names and fix QUICEchoApp
 discard fd297fa  Remove binary and add sourcecodes instead
 discard 0ea8c79  add more tests and fix QUICPacket impl
 discard 228921c  Add packet build function
 discard 9b867c4  implement quic packet 02
 discard 85a71c2  Add QUICPacketManager
 discard bc448eb  Add QUICEchoApp
 discard b9bac75  Parse QUIC packet payload & Collect Stream Frame DATA
 discard b0975ea  Echo from QuicClientSession
 discard 5c8c44a  Add QuicClientSession [DOESN'T WORK]
 discard 9b351a3  Emits ACCEPT event
 discard 630ded1  Move QuicSessionAccept to proxy/quic/
 discard 762876e  Move the echo logic into QUICNetVConnection
 discard d08ad01  Try to create VNetConnection.
 discard 9f2b6d8  Move the low layer implementation into iocore
 discard b92b75a  Open an UDP socket

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


[trafficserver] branch master updated: closing http2 state as draining http2 connection

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

masaori 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 6ecc998  closing http2 state as draining http2 connection
6ecc998 is described below

commit 6ecc9983010434942c339c0756d6d08ad3bd68b0
Author: Zizhong Zhang <zizh...@linkedin.com>
AuthorDate: Wed Jun 7 22:07:34 2017 -0700

closing http2 state as draining http2 connection
---
 proxy/http2/Http2ConnectionState.cc | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 16ed21d..30a2412 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1158,11 +1158,14 @@ Http2ConnectionState::release_stream(Http2Stream 
*stream)
 vc->add_to_keep_alive_queue();
   }
 }
-
-if ((fini_received || shutdown_state == IN_PROGRESS) && 
total_client_streams_count == 0) {
-  // We were shutting down, go ahead and terminate the session
-  ua_session->destroy();
-  ua_session = nullptr;
+if (total_client_streams_count == 0) {
+  if (fini_received) {
+// We were shutting down, go ahead and terminate the session
+ua_session->destroy();
+ua_session = nullptr;
+  } else if (shutdown_state == IN_PROGRESS) {
+this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+  }
 }
   }
 }

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


[trafficserver] branch master updated: Add half_close state in Http2ClientSession

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

masaori 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  daea3d7   Add half_close state in Http2ClientSession
daea3d7 is described below

commit daea3d7659b0460a6d56897691c5b948b3259279
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Apr 14 17:07:56 2017 +0900

Add half_close state in Http2ClientSession

Http2ClientSession is set half_close state after GOAWAY frame is sent to 
client.
In half_close state, TS doesn't create new HTTP/2 stream.
---
 proxy/http2/Http2ClientSession.cc   | 12 +++
 proxy/http2/Http2ClientSession.h|  8 +
 proxy/http2/Http2ConnectionState.cc | 68 +++--
 3 files changed, 63 insertions(+), 25 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 6b68f53..8de77f2 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -67,6 +67,7 @@ Http2ClientSession::Http2ClientSession()
 sm_writer(nullptr),
 upgrade_context(),
 kill_me(false),
+half_close(false),
 recursion(0)
 {
 }
@@ -284,6 +285,15 @@ Http2ClientSession::reenable(VIO *vio)
   this->client_vc->reenable(vio);
 }
 
+void
+Http2ClientSession::set_half_close_flag(bool flag)
+{
+  if (!half_close && flag) {
+DebugHttp2Ssn("session half-close");
+  }
+  half_close = flag;
+}
+
 int
 Http2ClientSession::main_event_handler(int event, void *edata)
 {
@@ -496,6 +506,8 @@ Http2ClientSession::state_process_frame_read(int event, VIO 
*vio, bool inside_fr
 SCOPED_MUTEX_LOCK(lock, this->connection_state.mutex, this_ethread());
 if (!this->connection_state.is_state_closed()) {
   
this->connection_state.send_goaway_frame(this->connection_state.get_latest_stream_id_in(),
 err);
+  this->set_half_close_flag(true);
+  this->do_io_close();
 }
   }
   return 0;
diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index 2e9442e..553f8d8 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -282,6 +282,13 @@ public:
 return retval;
   }
 
+  void set_half_close_flag(bool flag) override;
+  bool
+  get_half_close_flag() const override
+  {
+return half_close;
+  }
+
 private:
   Http2ClientSession(Http2ClientSession &);  // noncopyable
   Http2ClientSession =(const Http2ClientSession &); // noncopyable
@@ -316,6 +323,7 @@ private:
   VIO *write_vio;
   int dying_event;
   bool kill_me;
+  bool half_close;
   int recursion;
 };
 
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 3248643..52b4dcd 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -863,6 +863,8 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
 
   // Finalize HTTP/2 Connection
   case HTTP2_SESSION_EVENT_FINI: {
+SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
+
 ink_assert(this->fini_received == false);
 this->fini_received = true;
 cleanup_streams();
@@ -904,17 +906,11 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
 error.msg);
 }
 this->send_goaway_frame(this->latest_streamid_in, error.code);
+this->ua_session->set_half_close_flag(true);
+this_ethread()->schedule_imm_local((Continuation *)this, 
HTTP2_SESSION_EVENT_FINI);
+
 // The streams will be cleaned up by the HTTP2_SESSION_EVENT_FINI event
 // The Http2ClientSession will shutdown because 
connection_state.is_state_closed() will be true
-
-// XXX We need to think a bit harder about how to coordinate the client
-// session and the
-// protocol connection. At this point, the protocol is shutting down,
-// but there's no way
-// to tell that to the client session. Perhaps this could be solved by
-// implementing the
-// half-closed state ...
-SET_HANDLER(::state_closed);
   } else if (error.cls == Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM) {
 if (error.msg) {
   Error("HTTP/2 stream error client_ip=%s session_id=%" PRId64 " %s", 
client_ip, ua_session->connection_id(), error.msg);
@@ -953,6 +949,13 @@ Http2ConnectionState::state_closed(int /* event */, void * 
/* edata */)
 Http2Stream *
 Http2ConnectionState::create_stream(Http2StreamId new_id, Http2Error )
 {
+  // In half_close state, TS doesn't create new stream. Because GOAWAY frame 
is sent to client
+  if (ua_session && ua_session->get_half_close_flag()) {
+error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR

[trafficserver] branch master updated: Fix Last-Stream-ID of GOAWAY frame

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

masaori 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  1fb534c   Fix Last-Stream-ID of GOAWAY frame
1fb534c is described below

commit 1fb534c3518ade7755bb282ba4971b2194df0428
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Apr 28 16:09:51 2017 +0900

Fix Last-Stream-ID of GOAWAY frame
---
 proxy/http2/Http2ClientSession.cc   | 2 +-
 proxy/http2/Http2ConnectionState.cc | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
index 74bfab8..6b68f53 100644
--- a/proxy/http2/Http2ClientSession.cc
+++ b/proxy/http2/Http2ClientSession.cc
@@ -495,7 +495,7 @@ Http2ClientSession::state_process_frame_read(int event, VIO 
*vio, bool inside_fr
   if (err > Http2ErrorCode::HTTP2_ERROR_NO_ERROR) {
 SCOPED_MUTEX_LOCK(lock, this->connection_state.mutex, this_ethread());
 if (!this->connection_state.is_state_closed()) {
-  this->connection_state.send_goaway_frame(this->current_hdr.streamid, 
err);
+  
this->connection_state.send_goaway_frame(this->connection_state.get_latest_stream_id_in(),
 err);
 }
   }
   return 0;
diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index fcbf61a..bf4a7aa 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -897,7 +897,7 @@ Http2ConnectionState::main_event_handler(int event, void 
*edata)
   Error("HTTP/2 connection error client_ip=%s session_id=%" PRId64 " 
%s", client_ip, ua_session->connection_id(),
 error.msg);
 }
-this->send_goaway_frame(stream_id, error.code);
+this->send_goaway_frame(this->latest_streamid_in, error.code);
 // The streams will be cleaned up by the HTTP2_SESSION_EVENT_FINI event
 // The Http2ClientSession will shutdown because 
connection_state.is_state_closed() will be true
 
@@ -1350,7 +1350,7 @@ Http2ConnectionState::send_headers_frame(Http2Stream 
*stream)
 
   // Change stream state
   if (!stream->change_state(HTTP2_FRAME_TYPE_HEADERS, flags)) {
-this->send_goaway_frame(stream->get_id(), 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
+this->send_goaway_frame(this->latest_streamid_in, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
 h2_hdr.destroy();
 ats_free(buf);
 return;
@@ -1508,7 +1508,7 @@ Http2ConnectionState::send_rst_stream_frame(Http2StreamId 
id, Http2ErrorCode ec)
   Http2Stream *stream = find_stream(id);
   if (stream != nullptr) {
 if (!stream->change_state(HTTP2_FRAME_TYPE_RST_STREAM, 0)) {
-  this->send_goaway_frame(stream->get_id(), 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
+  this->send_goaway_frame(this->latest_streamid_in, 
Http2ErrorCode::HTTP2_ERROR_PROTOCOL_ERROR);
   return;
 }
   }
@@ -1541,7 +1541,7 @@ Http2ConnectionState::send_settings_frame(const 
Http2ConnectionSettings _set
 
   // Write settings to send buffer
   if (!http2_write_settings(param, iov)) {
-send_goaway_frame(0, Http2ErrorCode::HTTP2_ERROR_INTERNAL_ERROR);
+send_goaway_frame(this->latest_streamid_in, 
Http2ErrorCode::HTTP2_ERROR_INTERNAL_ERROR);
 return;
   }
   iov.iov_base = reinterpret_cast(iov.iov_base) + 
HTTP2_SETTINGS_PARAMETER_LEN;

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


[trafficserver] branch master updated: Coverity 1374845: Null pointer dereferences

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

masaori 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  d29a7cb   Coverity 1374845: Null pointer dereferences
d29a7cb is described below

commit d29a7cbe2362451e12aa65ff7f03f8d08608872e
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue May 9 08:36:25 2017 +0900

Coverity 1374845: Null pointer dereferences
---
 proxy/http2/Http2ConnectionState.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/http2/Http2ConnectionState.cc 
b/proxy/http2/Http2ConnectionState.cc
index 6f10445..84b2ff9 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -974,7 +974,7 @@ Http2Stream *
 Http2ConnectionState::create_stream(Http2StreamId new_id, Http2Error )
 {
   // In half_close state, TS doesn't create new stream. Because GOAWAY frame 
is sent to client
-  if (ua_session && ua_session->get_half_close_flag()) {
+  if (ua_session->get_half_close_flag()) {
 error = Http2Error(Http2ErrorClass::HTTP2_ERROR_CLASS_STREAM, 
Http2ErrorCode::HTTP2_ERROR_REFUSED_STREAM,
"refused to create new stream, because ua_session is in 
half_close state");
 return nullptr;

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


[trafficserver] branch quic-latest updated: [draft-05] Fix QUICLossDetector to follow pseudocode of draft-05

2017-09-11 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 5442415  [draft-05] Fix QUICLossDetector to follow pseudocode of 
draft-05
5442415 is described below

commit 5442415d17b4062a9cf5b64db62a103d6ff559a9
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Sep 12 09:56:37 2017 +0900

[draft-05] Fix QUICLossDetector to follow pseudocode of draft-05
---
 iocore/net/quic/QUICLossDetector.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/QUICLossDetector.cc 
b/iocore/net/quic/QUICLossDetector.cc
index feb48aa..fb72bc2 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -45,6 +45,7 @@ QUICLossDetector::QUICLossDetector(QUICPacketTransmitter 
*transmitter) : _transm
   this->_rttvar   = 0;
   this->_largest_sent_before_rto  = 0;
   this->_time_of_last_sent_packet = 0;
+  this->_largest_sent_packet  = 0;
 
   SET_HANDLER(::event_handler);
 }
@@ -183,6 +184,7 @@ void
 QUICLossDetector::_on_ack_received(const std::shared_ptr 
_frame)
 {
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
+  this->_largest_acked_packet = ack_frame->largest_acknowledged();
   // If the largest acked is newly acked, update the RTT.
   auto pi = this->_sent_packets.find(ack_frame->largest_acknowledged());
   if (pi != this->_sent_packets.end()) {
@@ -208,7 +210,6 @@ QUICLossDetector::_on_packet_acked(QUICPacketNumber 
acked_packet_number)
 {
   SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
   Debug("quic_loss_detector", "Packet number %" PRIu64 " has been acked", 
acked_packet_number);
-  this->_largest_acked_packet = acked_packet_number;
   // If a packet sent prior to RTO was acked, then the RTO
   // was spurious.  Otherwise, inform congestion control.
   if (this->_rto_count > 0 && acked_packet_number > 
this->_largest_sent_before_rto) {

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


[trafficserver] branch quic-latest updated: Acquire a lock before _frame_send_queue operation

2017-09-14 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 47078f9  Acquire a lock before _frame_send_queue operation
47078f9 is described below

commit 47078f9aa1c62e9b7e80fb2fe2d95aeb5b1fa139
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Sep 15 11:25:11 2017 +0900

Acquire a lock before _frame_send_queue operation
---
 iocore/net/P_QUICNetVConnection.h   |  5 +++--
 iocore/net/QUICNetVConnection.cc| 20 +---
 iocore/net/quic/QUICLossDetector.cc |  2 +-
 iocore/net/quic/QUICPacketTransmitter.h |  2 +-
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 01b689c..b29d2d6 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -181,7 +181,7 @@ public:
   // QUICConnection (QUICPacketTransmitter)
   virtual void transmit_packet(std::unique_ptr<QUICPacket, 
QUICPacketDeleterFunc> packet) override;
   virtual void retransmit_packet(const QUICPacket ) override;
-  virtual Ptr get_transmitter_mutex() override;
+  virtual Ptr get_packet_transmitter_mutex() override;
 
   // QUICConnection (QUICFrameTransmitter)
   virtual void transmit_frame(std::unique_ptr<QUICFrame, QUICFrameDeleterFunc> 
frame) override;
@@ -236,7 +236,8 @@ private:
   QUICError _state_common_receive_packet();
   QUICError _state_common_send_packet();
 
-  Ptr _transmitter_mutex;
+  Ptr _packet_transmitter_mutex;
+  Ptr _frame_transmitter_mutex;
 
   QUICApplication *_create_application();
   void _init_flow_control_params(const std::shared_ptr _tp,
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 8f25ca9..aefd28c 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -61,9 +61,10 @@ QUICNetVConnection::QUICNetVConnection() : 
UnixNetVConnection()
 void
 QUICNetVConnection::init(UDPConnection *udp_con, QUICPacketHandler 
*packet_handler)
 {
-  this->_transmitter_mutex = new_ProxyMutex();
-  this->_udp_con   = udp_con;
-  this->_packet_handler= packet_handler;
+  this->_packet_transmitter_mutex = new_ProxyMutex();
+  this->_frame_transmitter_mutex  = new_ProxyMutex();
+  this->_udp_con  = udp_con;
+  this->_packet_handler   = packet_handler;
   this->_quic_connection_id.randomize();
 
   // FIXME These should be done by HttpProxyServerMain
@@ -231,9 +232,9 @@ QUICNetVConnection::retransmit_packet(const QUICPacket 
)
 }
 
 Ptr
-QUICNetVConnection::get_transmitter_mutex()
+QUICNetVConnection::get_packet_transmitter_mutex()
 {
-  return this->_transmitter_mutex;
+  return this->_packet_transmitter_mutex;
 }
 
 void
@@ -248,6 +249,8 @@ void
 QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, 
QUICFrameDeleterFunc> frame)
 {
   DebugQUICCon("Type=%s Size=%zu", QUICDebugNames::frame_type(frame->type()), 
frame->size());
+
+  SCOPED_MUTEX_LOCK(frame_transmitter_lock, this->_frame_transmitter_mutex, 
this_ethread());
   this->_frame_send_queue.push(std::move(frame));
   if (!this->_packet_write_ready) {
 this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, 
QUIC_EVENT_PACKET_WRITE_READY, nullptr);
@@ -641,6 +644,8 @@ QUICNetVConnection::_state_common_send_packet()
   if (error.cls != QUICErrorClass::NONE) {
 return error;
   }
+
+  SCOPED_MUTEX_LOCK(packet_transmitter_lock, 
this->get_packet_transmitter_mutex().get(), this_ethread());
   while ((packet = this->_packet_send_queue.dequeue()) != nullptr) {
 this->_packet_handler->send_packet(*packet, this);
 this->_loss_detector->on_packet_sent(
@@ -666,6 +671,7 @@ QUICNetVConnection::_packetize_frames()
   QUICPacketType previous_packet_type = QUICPacketType::UNINITIALIZED;
   QUICPacketType current_packet_type  = QUICPacketType::UNINITIALIZED;
 
+  SCOPED_MUTEX_LOCK(frame_transmitter_lock, this->_frame_transmitter_mutex, 
this_ethread());
   while (this->_frame_send_queue.size() > 0) {
 frame = std::move(this->_frame_send_queue.front());
 this->_frame_send_queue.pop();
@@ -678,7 +684,7 @@ QUICNetVConnection::_packetize_frames()
 }
 if (len + frame->size() + MAX_PACKET_OVERHEAD > max_size || 
(previous_packet_type != current_packet_type && len > 0)) {
   ink_assert(len > 0);
-  SCOPED_MUTEX_LOCK(transmitter_lock, this->get_transmitter_mutex().get(), 
this_ethread());
+  SCOPED_MUTEX_LOCK(packet_transmitter_lock, 
this->get_packet_transmitter_mutex().get(), this_ethread());
   this->transmit_packet(this->_build_packet(std::move(buf), len, 
retransmittable, previous_packet_type));
   len = 0;

[trafficserver] branch quic-latest updated: Clear tracked event in the begnning of the event procedure

2017-09-14 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 1eb074f  Clear tracked event in the begnning of the event procedure
1eb074f is described below

commit 1eb074fa2a96ded10371cee3e7ad991b17659887
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Sep 15 12:28:53 2017 +0900

Clear tracked event in the begnning of the event procedure

- Clear tracked event in the begnning of the event procedure
- Add interal version of transmit_frame() and transmit_packet()

The methods from QUICPacketTransmitter and QUICFrameTransmitter could be 
called
from QUICApplication. In that cases, PACKET_WRITE_READY event should be 
scheduled
(if there're no tracked event). OTOH, internally called enqueue and dequeue 
frames
or packets should not schedule event. So this change separate the methods 
for
internal and external, and clear tracked event in the beggining.
---
 iocore/net/P_QUICNetVConnection.h |  3 +++
 iocore/net/QUICNetVConnection.cc  | 47 +++
 iocore/net/quic/QUICPacket.h  |  1 +
 3 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index b29d2d6..9bb2b1a 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -223,6 +223,9 @@ private:
 
   Event *_packet_write_ready = nullptr;
 
+  void _transmit_packet(QUICPacketPtr);
+  void _transmit_frame(QUICFramePtr);
+
   void _packetize_frames();
   std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> 
_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 aefd28c..56246df 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -197,10 +197,19 @@ QUICNetVConnection::maximum_stream_frame_data_size()
 }
 
 void
-QUICNetVConnection::transmit_packet(std::unique_ptr<QUICPacket, 
QUICPacketDeleterFunc> packet)
+QUICNetVConnection::_transmit_packet(QUICPacketPtr packet)
 {
+  DebugQUICCon("Packet Type=%s Size=%hu", 
QUICDebugNames::packet_type(packet->type()), packet->size());
+
+  SCOPED_MUTEX_LOCK(packet_transmitter_lock, this->_packet_transmitter_mutex, 
this_ethread());
   // TODO Remove const_cast
   this->_packet_send_queue.enqueue(const_cast(packet.release()));
+}
+
+void
+QUICNetVConnection::transmit_packet(std::unique_ptr<QUICPacket, 
QUICPacketDeleterFunc> packet)
+{
+  this->_transmit_packet(std::move(packet));
   if (!this->_packet_write_ready) {
 this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, 
QUIC_EVENT_PACKET_WRITE_READY, nullptr);
   }
@@ -246,13 +255,20 @@ 
QUICNetVConnection::push_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFun
 }
 
 void
-QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, 
QUICFrameDeleterFunc> frame)
+QUICNetVConnection::_transmit_frame(QUICFramePtr frame)
 {
-  DebugQUICCon("Type=%s Size=%zu", QUICDebugNames::frame_type(frame->type()), 
frame->size());
+  DebugQUICCon("Frame Type=%s Size=%zu", 
QUICDebugNames::frame_type(frame->type()), frame->size());
 
   SCOPED_MUTEX_LOCK(frame_transmitter_lock, this->_frame_transmitter_mutex, 
this_ethread());
   this->_frame_send_queue.push(std::move(frame));
+}
+
+void
+QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, 
QUICFrameDeleterFunc> frame)
+{
+  this->_transmit_frame(std::move(frame));
   if (!this->_packet_write_ready) {
+DebugQUICCon("Schedule %s event", 
QUICDebugNames::quic_event(QUIC_EVENT_PACKET_WRITE_READY));
 this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, 
QUIC_EVENT_PACKET_WRITE_READY, nullptr);
   }
 }
@@ -362,8 +378,10 @@ QUICNetVConnection::state_handshake(int event, Event *data)
 break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
-error = this->_state_common_send_packet();
-this->_packet_write_ready = nullptr;
+if (this->_packet_write_ready == data) {
+  this->_packet_write_ready = nullptr;
+}
+error = this->_state_common_send_packet();
 break;
   }
   case EVENT_IMMEDIATE: {
@@ -407,11 +425,12 @@ QUICNetVConnection::state_connection_established(int 
event, Event *data)
 break;
   }
   case QUIC_EVENT_PACKET_WRITE_READY: {
-error = this->_state_common_send_packet();
-this->_packet_write_ready = nullptr;
+if (this->_packet_write_ready == data) {
+  this->_packet_write_ready = nullptr;
+

[trafficserver] branch quic-latest updated: Skip HTTP/1.1 response headers

2017-09-21 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 7d6097e  Skip HTTP/1.1 response headers
7d6097e is described below

commit 7d6097e360430a2494e154b55c9e9f77b949f6ce
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Sep 22 14:51:37 2017 +0900

Skip HTTP/1.1 response headers
---
 proxy/hq/HQClientTransaction.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/hq/HQClientTransaction.cc b/proxy/hq/HQClientTransaction.cc
index e217ce2..3284c40 100644
--- a/proxy/hq/HQClientTransaction.cc
+++ b/proxy/hq/HQClientTransaction.cc
@@ -243,7 +243,7 @@ HQClientTransaction::_write_response()
 {
   IOBufferReader *reader = this->_write_vio.get_reader();
 
-  if (memcmp(reader->start(), http_1_1_version, sizeof(http_1_1_version)) == 
0) {
+  if (memcmp(reader->start(), http_1_1_version, sizeof(http_1_1_version) - 1) 
== 0) {
 // Skip HTTP/1.1 response headers
 IOBufferBlock *headers = reader->get_current_block();
 int64_t headers_size   = headers->read_avail();

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


[trafficserver] branch quic-latest updated: Rename QUICStream::set_fin() to QUICStream::shutdown()

2017-09-22 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 e601615b Rename QUICStream::set_fin() to QUICStream::shutdown()
e601615b is described below

commit e601615b20dc73978acc2452d38d9b4c8169e1eb
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Sep 22 16:24:34 2017 +0900

Rename QUICStream::set_fin() to QUICStream::shutdown()
---
 iocore/net/quic/QUICApplication.cc | 4 ++--
 iocore/net/quic/QUICApplication.h  | 2 +-
 iocore/net/quic/QUICStream.cc  | 2 +-
 iocore/net/quic/QUICStream.h   | 2 +-
 proxy/hq/HQClientTransaction.cc| 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/iocore/net/quic/QUICApplication.cc 
b/iocore/net/quic/QUICApplication.cc
index 1ba29dd..61c1429 100644
--- a/iocore/net/quic/QUICApplication.cc
+++ b/iocore/net/quic/QUICApplication.cc
@@ -98,9 +98,9 @@ QUICStreamIO::get_read_buffer_reader()
 }
 
 void
-QUICStreamIO::set_fin()
+QUICStreamIO::shutdown()
 {
-  return this->_stream->set_fin();
+  return this->_stream->shutdown();
 }
 
 //
diff --git a/iocore/net/quic/QUICApplication.h 
b/iocore/net/quic/QUICApplication.h
index 8a20fc3..20059d7 100644
--- a/iocore/net/quic/QUICApplication.h
+++ b/iocore/net/quic/QUICApplication.h
@@ -46,7 +46,7 @@ public:
   void read_reenable();
   void write_reenable();
   IOBufferReader *get_read_buffer_reader();
-  void set_fin();
+  void shutdown();
 
 private:
   QUICStream *_stream = nullptr;
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 4ecb125..3b98289 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -397,7 +397,7 @@ QUICStream::reset()
 }
 
 void
-QUICStream::set_fin()
+QUICStream::shutdown()
 {
   this->_fin = true;
 }
diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h
index 0b06b64..d8b476c 100644
--- a/iocore/net/quic/QUICStream.h
+++ b/iocore/net/quic/QUICStream.h
@@ -65,7 +65,7 @@ public:
   QUICError recv(const std::shared_ptr frame);
 
   void reset();
-  void set_fin();
+  void shutdown();
 
   size_t nbytes_to_read();
 
diff --git a/proxy/hq/HQClientTransaction.cc b/proxy/hq/HQClientTransaction.cc
index cd894e9..92d8d36 100644
--- a/proxy/hq/HQClientTransaction.cc
+++ b/proxy/hq/HQClientTransaction.cc
@@ -264,7 +264,7 @@ HQClientTransaction::_write_response()
   // NOTE: When Chunked Transfer Coding is supported, check ChunkedState of 
ChunkedHandler
   // is CHUNK_READ_DONE and set FIN flag
   if (this->_write_vio.ntodo() == 0) {
-this->_stream_io->set_fin();
+this->_stream_io->shutdown();
   }
   this->_stream_io->write_reenable();
 }

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


[trafficserver] branch master updated: Coverity CID #1224619 Uninitialized members

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

masaori 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 e84cf75  Coverity CID #1224619 Uninitialized members
e84cf75 is described below

commit e84cf75cefdb40859e68d588bdecdac7720a84ba
Author: Phil Sorber <sor...@apache.org>
AuthorDate: Wed Sep 20 20:40:08 2017 -0600

Coverity CID #1224619 Uninitialized members
---
 proxy/http2/Http2ClientSession.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h
index f7209b0..d81fdbc 100644
--- a/proxy/http2/Http2ClientSession.h
+++ b/proxy/http2/Http2ClientSession.h
@@ -350,8 +350,8 @@ private:
   bool half_close_local = false;
   int recursion = 0;
 
-  InkHashTable *h2_pushed_urls;
-  uint32_t h2_pushed_urls_size;
+  InkHashTable *h2_pushed_urls = nullptr;
+  uint32_t h2_pushed_urls_size = 0;
 };
 
 extern ClassAllocator http2ClientSessionAllocator;

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


[trafficserver] branch quic-latest updated: Rename _frame_buffer of QUICNetVConnection to _frame_send_queue

2017-09-14 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 f973bcc  Rename _frame_buffer of QUICNetVConnection to 
_frame_send_queue
f973bcc is described below

commit f973bccd4b5b55f61104ada6e231495672756acb
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Sep 15 10:56:46 2017 +0900

Rename _frame_buffer of QUICNetVConnection to _frame_send_queue
---
 iocore/net/P_QUICNetVConnection.h | 2 +-
 iocore/net/QUICNetVConnection.cc  | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 61d16e2..01b689c 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -219,7 +219,7 @@ private:
 
   Queue _packet_recv_queue;
   Queue _packet_send_queue;
-  std::queue<std::unique_ptr<QUICFrame, QUICFrameDeleterFunc>> _frame_buffer;
+  std::queue _frame_send_queue;
 
   Event *_packet_write_ready = nullptr;
 
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index b0df002..8f25ca9 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -248,7 +248,7 @@ void
 QUICNetVConnection::transmit_frame(std::unique_ptr<QUICFrame, 
QUICFrameDeleterFunc> frame)
 {
   DebugQUICCon("Type=%s Size=%zu", QUICDebugNames::frame_type(frame->type()), 
frame->size());
-  this->_frame_buffer.push(std::move(frame));
+  this->_frame_send_queue.push(std::move(frame));
   if (!this->_packet_write_ready) {
 this->_packet_write_ready = eventProcessor.schedule_imm(this, ET_CALL, 
QUIC_EVENT_PACKET_WRITE_READY, nullptr);
   }
@@ -666,9 +666,9 @@ QUICNetVConnection::_packetize_frames()
   QUICPacketType previous_packet_type = QUICPacketType::UNINITIALIZED;
   QUICPacketType current_packet_type  = QUICPacketType::UNINITIALIZED;
 
-  while (this->_frame_buffer.size() > 0) {
-frame = std::move(this->_frame_buffer.front());
-this->_frame_buffer.pop();
+  while (this->_frame_send_queue.size() > 0) {
+frame = std::move(this->_frame_send_queue.front());
+this->_frame_send_queue.pop();
 QUICRetransmissionFrame *rf = dynamic_cast(frame.get());
 previous_packet_type= current_packet_type;
 if (rf) {

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


[trafficserver] branch quic-latest updated (7d6097e -> 57011b1)

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

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


from 7d6097e  Skip HTTP/1.1 response headers
 add 57011b1  Set FIN flag on final STREAM frame

No new revisions were added by this update.

Summary of changes:
 iocore/net/quic/QUICApplication.cc |  8 +++-
 iocore/net/quic/QUICApplication.h  |  3 +++
 iocore/net/quic/QUICStream.cc  | 16 +---
 iocore/net/quic/QUICStream.h   |  2 ++
 proxy/hq/HQClientTransaction.cc|  8 +++-
 5 files changed, 32 insertions(+), 5 deletions(-)

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


[trafficserver] branch quic-latest updated: Add simple multi-streamed application

2017-09-21 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 53afc1e  Add simple multi-streamed application
53afc1e is described below

commit 53afc1ece0adfaff27a30e8b6189b0ce9ec08fa9
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Sep 22 10:47:12 2017 +0900

Add simple multi-streamed application

Also add HQClientSession and HQClientTransaction to connect to HttpSM
from QUICSimpleApp. HQClientTransaction convert HTTP/0.9 GETs to HTTP/1.1.
This will be changed to HTTP over QUIC eventually.
---
 iocore/net/P_QUICNetVConnection.h  |   2 +
 iocore/net/P_UnixNetVConnection.h  |   4 +-
 iocore/net/QUICNetVConnection.cc   |   9 +-
 iocore/net/UnixNetVConnection.cc   |   1 -
 iocore/net/quic/Makefile.am|   6 +-
 iocore/net/quic/QUICApplication.cc |  17 +++
 iocore/net/quic/QUICApplication.h  |   2 +
 iocore/net/quic/QUICSimpleApp.cc   |  92 +
 iocore/net/quic/QUICSimpleApp.h|  46 +++
 iocore/net/quic/QUICStream.h   |   1 +
 proxy/hq/HQClientSession.cc| 131 ++
 proxy/hq/HQClientSession.h |  58 
 proxy/hq/HQClientTransaction.cc| 271 +
 proxy/hq/HQClientTransaction.h |  67 +
 proxy/hq/Makefile.am   |   3 +-
 15 files changed, 701 insertions(+), 9 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 9bb2b1a..ae11bf2 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -147,9 +147,11 @@ public:
 
   void init(UDPConnection *, QUICPacketHandler *);
 
+  // UnixNetVConnection
   void reenable(VIO *vio) override;
   VIO *do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf) override;
   VIO *do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool 
owner = false) override;
+
   int startEvent(int event, Event *e);
   int state_pre_handshake(int event, Event *data);
   int state_handshake(int event, Event *data);
diff --git a/iocore/net/P_UnixNetVConnection.h 
b/iocore/net/P_UnixNetVConnection.h
index 91b8d2c..be3fbd0 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -281,8 +281,8 @@ public:
   ink_hrtime get_inactivity_timeout() override;
   ink_hrtime get_active_timeout() override;
 
-  void set_local_addr() override;
-  void set_remote_addr() override;
+  virtual void set_local_addr() override;
+  virtual void set_remote_addr() override;
   int set_tcp_init_cwnd(int init_cwnd) override;
   int set_tcp_congestion_control(int side) override;
   void apply_options() override;
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 56246df..978ea10 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -36,6 +36,7 @@
 #include "P_SSLNextProtocolSet.h"
 
 #include "QUICEchoApp.h"
+#include "QUICSimpleApp.h"
 #include "QUICDebugNames.h"
 #include "QUICEvents.h"
 #include "QUICConfig.h"
@@ -76,13 +77,15 @@ QUICNetVConnection::init(UDPConnection *udp_con, 
QUICPacketHandler *packet_handl
 VIO *
 QUICNetVConnection::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
 {
-  return super::do_io_read(c, nbytes, buf);
+  ink_assert(false);
+  return nullptr;
 }
 
 VIO *
 QUICNetVConnection::do_io_write(Continuation *c, int64_t nbytes, 
IOBufferReader *buf, bool owner)
 {
-  return super::do_io_write(c, nbytes, buf, owner);
+  ink_assert(false);
+  return nullptr;
 }
 
 int
@@ -796,7 +799,7 @@ QUICNetVConnection::_create_application()
   if (app_name) {
 DebugQUICCon("ALPN: %.*s", app_name_len, app_name);
 if (memcmp(TS_ALPN_PROTOCOL_HTTP_QUIC, app_name, app_name_len) == 0) {
-  return new QUICEchoApp(this);
+  return new QUICSimpleApp(this, this);
 } else {
   DebugQUICCon("Negotiated application is not available");
   ink_assert(false);
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index c974667..8b0f740 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -33,7 +33,6 @@
 
 // Global
 ClassAllocator netVCAllocator("netVCAllocator");
-
 //
 // Reschedule a UnixNetVConnection by moving it
 // onto or off of the ready_list
diff --git a/iocore/net/quic/Makefile.am b/iocore/net/quic/Makefile.am
index 40d7638..34463d7 100644
--- a/iocore/net/quic/Makefile.am
+++ b/iocore/net/quic/Makefile.am
@@ -26,9 +26,10 @@ AM_CPPFLAGS += \
   -I$(abs_top_srcdir)/proxy/hdrs \
   -I$(abs_top_srcdir)/proxy/shared \
   -I$(abs_top_srcdir)/proxy/logging \
+  -I$(abs_top_srcdir)/proxy/http \
+  -I$(abs_top_srcdir)/proxy/hq \
   -I$(abs_top_srcdir)/mgmt \
   -I$(abs_top_sr

[trafficserver] branch quic-latest updated: Add debug tag for handshake packet dump

2017-10-03 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 49ce8f1  Add debug tag for handshake packet dump
49ce8f1 is described below

commit 49ce8f11234a11639b9ee69829193fbb8845d2f3
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Oct 3 13:07:17 2017 -0700

Add debug tag for handshake packet dump
---
 iocore/net/quic/QUICHandshake.cc | 61 
 1 file changed, 43 insertions(+), 18 deletions(-)

diff --git a/iocore/net/quic/QUICHandshake.cc b/iocore/net/quic/QUICHandshake.cc
index 7c34690..9dbbc5f 100644
--- a/iocore/net/quic/QUICHandshake.cc
+++ b/iocore/net/quic/QUICHandshake.cc
@@ -29,24 +29,49 @@
 #include "QUICConfig.h"
 #include "P_SSLNextProtocolSet.h"
 
-#define I_WANNA_DUMP_THIS_BUF(buf, len)
   \
-  {
   \
-int i, j;  
   \
-fprintf(stderr, "len=%" PRId64 "\n", len); 
   \
-for (i = 0; i < len / 8; i++) {
   \
-  fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x ", buf[i * 8 + 
0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3], \
-  buf[i * 8 + 4], buf[i * 8 + 5], buf[i * 8 + 6], buf[i * 8 + 7]); 
   \
-  if ((i + 1) % 4 == 0 || (len % 8 == 0 && i + 1 == len / 8)) {
   \
-fprintf(stderr, "\n"); 
   \
-  }
   \
-}  
   \
-if (len % 8 != 0) {
   \
-  fprintf(stderr, "%0x", buf[i * 8 + 0]);  
   \
-  for (j = 1; j < len % 8; j++) {  
   \
-fprintf(stderr, " %02x", buf[i * 8 + j]);  
   \
-  }
   \
-  fprintf(stderr, "\n");   
   \
-}  
   \
+static constexpr char dump_tag[] = "quic_handshake_dump_pkt";
+
+#define I_WANNA_DUMP_THIS_BUF(buf, len)
\
+  {
\
+int i; 
\
+Debug(dump_tag, "len=%" PRId64 "\n", len); 
\
+for (i = 0; i < len / 8; i++) {
\
+  Debug(dump_tag, "%02x %02x %02x %02x %02x %02x %02x %02x ", buf[i * 8 + 
0], buf[i * 8 + 1], buf[i * 8 + 2], buf[i * 8 + 3],  \
+buf[i * 8 + 4], buf[i * 8 + 5], buf[i * 8 + 6], buf[i * 8 + 7]);   
\
+}  
\
+switch (len % 8) { 
\
+case 1:

[trafficserver] branch quic-latest updated: Set default app name if client send no ALPN

2017-10-03 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 4617336  Set default app name if client send no ALPN
4617336 is described below

commit 4617336ff08ad85c1e33ebad83aea45abf2af3ef
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Tue Oct 3 15:55:23 2017 -0700

Set default app name if client send no ALPN
---
 iocore/net/QUICNetVConnection.cc | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 39ad79c..ddefb82 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -436,8 +436,18 @@ QUICNetVConnection::state_handshake(int event, Event *data)
 const uint8_t *app_name;
 unsigned int app_name_len = 0;
 this->_handshake_handler->negotiated_application_name(_name, 
_name_len);
+if (app_name == nullptr) {
+  app_name = reinterpret_cast(IP_PROTO_TAG_HTTP_QUIC.ptr());
+  app_name_len = IP_PROTO_TAG_HTTP_QUIC.size();
+}
+
 Continuation *endpoint = this->_next_protocol_set->findEndpoint(app_name, 
app_name_len);
-endpoint->handleEvent(NET_EVENT_ACCEPT, this);
+if (endpoint == nullptr) {
+  this->_handle_error(
+QUICErrorUPtr(new QUICConnectionError(QUICErrorClass::CRYPTOGRAPHIC, 
QUICErrorCode::VERSION_NEGOTIATION_ERROR)));
+} else {
+  endpoint->handleEvent(NET_EVENT_ACCEPT, this);
+}
   }
 
   return EVENT_CONT;

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


[trafficserver] branch quic-latest updated: Stop Version Negotiation Packet retransmission

2017-10-12 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 e72cfd9  Stop Version Negotiation Packet retransmission
e72cfd9 is described below

commit e72cfd9c10b940971ff2643d46417ab4098656fa
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Fri Oct 13 12:02:30 2017 +0900

Stop Version Negotiation Packet retransmission
---
 iocore/net/QUICNetVConnection.cc| 2 ++
 iocore/net/quic/QUICLossDetector.cc | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index a941336..4229c56 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -228,6 +228,8 @@ QUICNetVConnection::transmit_packet(QUICPacketUPtr packet)
 void
 QUICNetVConnection::retransmit_packet(const QUICPacket )
 {
+  ink_assert(packet.type() != QUICPacketType::VERSION_NEGOTIATION && 
packet.type() != QUICPacketType::UNINITIALIZED);
+
   uint16_t size  = packet.payload_size();
   const uint8_t *payload = packet.payload();
 
diff --git a/iocore/net/quic/QUICLossDetector.cc 
b/iocore/net/quic/QUICLossDetector.cc
index b9d3c10..41bb3fc 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -145,8 +145,9 @@ QUICLossDetector::on_packet_sent(QUICPacketUPtr packet)
 
   bool is_handshake   = false;
   QUICPacketType type = packet->type();
-  if (type != QUICPacketType::ZERO_RTT_PROTECTED && type != 
QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_0 &&
-  type != QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_1) {
+  // XXX: Should QUICPacketType::SERVER_STATELESS_RETRY be included?
+  if (type == QUICPacketType::CLIENT_INITIAL || type == 
QUICPacketType::SERVER_CLEARTEXT ||
+  type == QUICPacketType::CLIENT_CLEARTEXT) {
 is_handshake = true;
   }
 

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


[trafficserver] branch quic-latest updated (88b5d7c -> 2250a41)

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

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


omit 88b5d7c  Fix heap-use-after-free
omit a0e5c98  Fix building unit tests of quic
 new d46ff12  Fix building unit tests of quic
 new 2250a41  Fix heap-use-after-free in QUICStreamFrame::store

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (88b5d7c)
\
 N -- N -- N   refs/heads/quic-latest (2250a41)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/quic/QUICFrame.cc   |  7 ++-
 iocore/net/quic/QUICFrame.h|  2 +-
 iocore/net/quic/QUICStream.cc  |  6 +--
 .../net/quic/test/test_QUICIncomingFrameBuffer.cc  | 52 +-
 iocore/net/quic/test/test_QUICStreamManager.cc | 40 +++--
 iocore/net/quic/test/test_QUICStreamState.cc   | 48 +---
 proxy/hq/HQClientTransaction.cc|  1 -
 7 files changed, 53 insertions(+), 103 deletions(-)

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


[trafficserver] 01/02: Fix building unit tests of quic

2017-10-12 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

commit d46ff1251c628b642f1822591d1ac5126e916933
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Oct 12 14:11:32 2017 +0900

Fix building unit tests of quic
---
 .gitignore   | 1 +
 iocore/net/quic/test/Makefile.am | 8 
 2 files changed, 9 insertions(+)

diff --git a/.gitignore b/.gitignore
index de3eff5..ed253d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,6 +103,7 @@ iocore/net/quic/test/test_QUICTypeUtil
 iocore/net/quic/test/test_QUICAckFrameCreator
 iocore/net/quic/test/test_QUICVersionNegotiator
 iocore/net/quic/test/test_QUICFlowController
+iocore/net/quic/test/test_QUICIncomingFrameBuffer
 iocore/net/quic/ts_quic_client
 iocore/aio/test_AIO
 iocore/eventsystem/test_Buffer
diff --git a/iocore/net/quic/test/Makefile.am b/iocore/net/quic/test/Makefile.am
index e25eced..b53ec4d 100644
--- a/iocore/net/quic/test/Makefile.am
+++ b/iocore/net/quic/test/Makefile.am
@@ -132,6 +132,7 @@ test_QUICFrame_SOURCES = \
   ../QUICTypes.cc \
   ../QUICStream.cc \
   ../QUICStreamState.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICDebugNames.cc \
   ../QUICFlowController.cc \
   ../../SSLNextProtocolSet.cc
@@ -166,6 +167,7 @@ test_QUICFrameDispatcher_SOURCES = \
   ../QUICPacket.cc \
   ../QUICStream.cc \
   ../QUICStreamState.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICApplication.cc \
   ../QUICHandshake.cc \
   ../QUICTypes.cc \
@@ -252,6 +254,7 @@ test_QUICStreamManager_SOURCES = \
   event_processor_main.cc \
   test_QUICStreamManager.cc \
   ../QUICStream.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICFrameDispatcher.cc \
   ../QUICStreamManager.cc \
   ../QUICApplicationMap.cc \
@@ -290,6 +293,7 @@ test_QUICTransportParameters_SOURCES = \
   ../QUICCrypto.cc \
   $(QUICCrypto_impl) \
   ../QUICStream.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICStreamState.cc \
   ../QUICStreamManager.cc \
   ../QUICFlowController.cc \
@@ -380,6 +384,7 @@ test_QUICTypeUtil_SOURCES = \
   main.cc \
   test_QUICTypeUtil.cc \
   ../QUICStream.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICStreamState.cc \
   ../QUICFlowController.cc \
   ../QUICDebugNames.cc \
@@ -411,6 +416,7 @@ test_QUICAckFrameCreator_SOURCES = \
   ../QUICFrame.cc \
   ../QUICPacket.cc \
   ../QUICStream.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICStreamState.cc \
   ../QUICFlowController.cc \
   ../QUICDebugNames.cc \
@@ -449,6 +455,7 @@ test_QUICVersionNegotiator_SOURCES = \
   ../QUICApplicationMap.cc \
   ../QUICHandshake.cc \
   ../QUICStream.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICStreamState.cc \
   ../QUICStreamManager.cc \
   ../QUICFlowController.cc \
@@ -483,6 +490,7 @@ test_QUICFlowController_SOURCES = \
   test_QUICFlowController.cc \
   ../QUICFlowController.cc \
   ../QUICStream.cc \
+  ../QUICIncomingFrameBuffer.cc \
   ../QUICStreamState.cc \
   ../QUICDebugNames.cc \
   ../QUICTypes.cc \

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.


[trafficserver] 02/02: Fix heap-use-after-free in QUICStreamFrame::store

2017-10-12 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

commit 2250a414d8818b5f6b781a9ee9811521d6022e20
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Thu Oct 12 16:34:14 2017 +0900

Fix heap-use-after-free in QUICStreamFrame::store

Make data of QUICStramFrame ats_unique_buf. Copy data of _write_vio
to the buffer, when QUICStream sends frame. Ideally this malloc and
copy should be avoided.
---
 iocore/net/quic/QUICFrame.cc |  11 +-
 iocore/net/quic/QUICFrame.h  |   4 +-
 iocore/net/quic/test/test_QUICFrame.cc   |  50 +-
 iocore/net/quic/test/test_QUICFrameDispatcher.cc |   7 +-
 iocore/net/quic/test/test_QUICStream.cc  | 215 +--
 5 files changed, 174 insertions(+), 113 deletions(-)

diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 69951d4..4bb02b4 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -72,9 +72,9 @@ QUICFrame::reset(const uint8_t *buf, size_t len)
 // STREAM Frame
 //
 
-QUICStreamFrame::QUICStreamFrame(const uint8_t *data, size_t data_len, 
QUICStreamId stream_id, QUICOffset offset, bool last)
+QUICStreamFrame::QUICStreamFrame(ats_unique_buf data, size_t data_len, 
QUICStreamId stream_id, QUICOffset offset, bool last)
 {
-  this->_data  = data;
+  this->_data  = std::move(data);
   this->_data_len  = data_len;
   this->_stream_id = stream_id;
   this->_offset= offset;
@@ -183,7 +183,7 @@ QUICStreamFrame::data() const
   if (this->_buf) {
 return this->_buf + this->_get_data_offset();
   } else {
-return this->_data;
+return this->_data.get();
   }
 }
 
@@ -1315,8 +1315,11 @@ QUICFrameFactory::fast_create(const uint8_t *buf, size_t 
len)
 QUICStreamFrameUPtr
 QUICFrameFactory::create_stream_frame(const uint8_t *data, size_t data_len, 
QUICStreamId stream_id, QUICOffset offset, bool last)
 {
+  ats_unique_buf buf = ats_unique_malloc(data_len);
+  memcpy(buf.get(), data, data_len);
+
   QUICStreamFrame *frame = quicStreamFrameAllocator.alloc();
-  new (frame) QUICStreamFrame(data, data_len, stream_id, offset, last);
+  new (frame) QUICStreamFrame(std::move(buf), data_len, stream_id, offset, 
last);
   return QUICStreamFrameUPtr(frame, ::delete_stream_frame);
 }
 
diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h
index 772d65a..9f2b356 100644
--- a/iocore/net/quic/QUICFrame.h
+++ b/iocore/net/quic/QUICFrame.h
@@ -59,7 +59,7 @@ class QUICStreamFrame : public QUICFrame
 public:
   QUICStreamFrame() : QUICFrame() {}
   QUICStreamFrame(const uint8_t *buf, size_t len) : QUICFrame(buf, len) {}
-  QUICStreamFrame(const uint8_t *buf, size_t len, QUICStreamId streamid, 
QUICOffset offset, bool last = false);
+  QUICStreamFrame(ats_unique_buf buf, size_t len, QUICStreamId streamid, 
QUICOffset offset, bool last = false);
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual void store(uint8_t *buf, size_t *len) const override;
@@ -74,7 +74,7 @@ public:
   LINK(QUICStreamFrame, link);
 
 private:
-  const uint8_t *_data= nullptr;
+  ats_unique_buf _data= {nullptr, [](void *p) { ats_free(p); }};
   size_t _data_len= 0;
   QUICStreamId _stream_id = 0;
   QUICOffset _offset  = 0;
diff --git a/iocore/net/quic/test/test_QUICFrame.cc 
b/iocore/net/quic/test/test_QUICFrame.cc
index 90c82fb..36f1eee 100644
--- a/iocore/net/quic/test/test_QUICFrame.cc
+++ b/iocore/net/quic/test/test_QUICFrame.cc
@@ -55,11 +55,14 @@ TEST_CASE("QUICFrame Type", "[quic]")
 
 TEST_CASE("Construct QUICFrame", "[quic]")
 {
-  uint8_t payload[] = "foo";
+  uint8_t raw[]  = "foo";
+  ats_unique_buf payload = ats_unique_malloc(sizeof(raw));
+  memcpy(payload.get(), raw, sizeof(raw));
+
   uint8_t buf[65536];
   size_t len;
 
-  QUICStreamFrame frame1(payload, sizeof(payload), 0xffcc9966, 
0xffddbb9977553311);
+  QUICStreamFrame frame1(std::move(payload), sizeof(raw), 0xffcc9966, 
0xffddbb9977553311);
   frame1.store(buf, );
   CHECK(frame1.type() == QUICFrameType::STREAM);
   CHECK(frame1.size() == 19);
@@ -119,7 +122,12 @@ TEST_CASE("Store STREAM Frame", "[quic]")
 0x00, 0x05,   // Data Length
 0x01, 0x02, 0x03, 0x04, 0x05, // Stream Data
   };
-  QUICStreamFrame streamFrame1(reinterpret_cast("\x01\x02\x03\x04\x05"), 5, 0x01, 0x00);
+
+  uint8_t raw1[]  = "\x01\x02\x03\x04\x05";
+  ats_unique_buf payload1 = ats_unique_malloc(5);
+  memcpy(payload1.get(), raw1, 5);
+
+  QUICStreamFrame streamFrame1(std::move(payload1), 5, 0x01, 0x00);
   streamFrame1.store(buf, );
   CHECK(len == 9);
   CHECK(memcmp(buf, expected1, len) == 0);
@@ -132,7 +140,11 @@ TEST_

[trafficserver] branch quic-latest updated: Cleanup QUICFrame

2017-09-11 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 fd62dfc  Cleanup QUICFrame
fd62dfc is described below

commit fd62dfc9f51d708ddb4e901057ee2c0e405ec1b2
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Sep 11 15:47:21 2017 +0900

Cleanup QUICFrame

- Replace hard-coded QUICFrameType
- Reorder arguments of QUICRstFrame constructor
- Use write_QUICStreamId()
---
 iocore/net/quic/QUICFrame.cc   | 32 
 iocore/net/quic/QUICFrame.h|  4 ++--
 iocore/net/quic/test/test_QUICFrame.cc | 14 +++---
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index c8f2229..6a07641 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -645,8 +645,8 @@ QUICAckFrame::TimestampSection::store(uint8_t *buf, size_t 
*len) const
 // RST_STREAM frame
 //
 
-QUICRstStreamFrame::QUICRstStreamFrame(QUICErrorCode error_code, QUICStreamId 
stream_id, QUICOffset final_offset)
-  : _error_code(error_code), _stream_id(stream_id), _final_offset(final_offset)
+QUICRstStreamFrame::QUICRstStreamFrame(QUICStreamId stream_id, QUICErrorCode 
error_code, QUICOffset final_offset)
+  : _stream_id(stream_id), _error_code(error_code), _final_offset(final_offset)
 {
 }
 
@@ -667,7 +667,7 @@ QUICRstStreamFrame::store(uint8_t *buf, size_t *len) const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x01;
+  *p = static_cast(QUICFrameType::RST_STREAM);
   ++p;
   QUICTypeUtil::write_QUICStreamId(this->_stream_id, 4, p, );
   p += n;
@@ -727,7 +727,7 @@ QUICPingFrame::size() const
 void
 QUICPingFrame::store(uint8_t *buf, size_t *len) const
 {
-  buf[0] = 0x07;
+  buf[0] = static_cast(QUICFrameType::PING);
   *len   = 1;
 }
 
@@ -749,7 +749,7 @@ QUICPaddingFrame::size() const
 void
 QUICPaddingFrame::store(uint8_t *buf, size_t *len) const
 {
-  buf[0] = 0x00;
+  buf[0] = static_cast(QUICFrameType::PADDING);
   *len   = 1;
 }
 
@@ -782,7 +782,7 @@ QUICConnectionCloseFrame::store(uint8_t *buf, size_t *len) 
const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x02;
+  *p = static_cast(QUICFrameType::CONNECTION_CLOSE);
   ++p;
   QUICTypeUtil::write_QUICErrorCode(this->_error_code, p, );
   p += n;
@@ -849,7 +849,7 @@ QUICMaxDataFrame::store(uint8_t *buf, size_t *len) const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x04;
+  *p = static_cast(QUICFrameType::MAX_DATA);
   ++p;
   QUICTypeUtil::write_uint_as_nbytes(this->_maximum_data, 8, p, );
   p += n;
@@ -893,9 +893,9 @@ QUICMaxStreamDataFrame::store(uint8_t *buf, size_t *len) 
const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x05;
+  *p = static_cast(QUICFrameType::MAX_STREAM_DATA);
   ++p;
-  QUICTypeUtil::write_uint_as_nbytes(this->_stream_id, 4, p, );
+  QUICTypeUtil::write_QUICStreamId(this->_stream_id, 4, p, );
   p += n;
   QUICTypeUtil::write_uint_as_nbytes(this->_maximum_stream_data, 8, p, );
   p += n;
@@ -948,7 +948,7 @@ QUICMaxStreamIdFrame::store(uint8_t *buf, size_t *len) const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x06;
+  *p = static_cast(QUICFrameType::MAX_STREAM_ID);
   ++p;
   QUICTypeUtil::write_uint_as_nbytes(this->_maximum_stream_id, 4, p, );
   p += n;
@@ -984,7 +984,7 @@ QUICBlockedFrame::size() const
 void
 QUICBlockedFrame::store(uint8_t *buf, size_t *len) const
 {
-  buf[0] = 0x08;
+  buf[0] = static_cast(QUICFrameType::BLOCKED);
   *len   = 1;
 }
 
@@ -1013,9 +1013,9 @@ QUICStreamBlockedFrame::store(uint8_t *buf, size_t *len) 
const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x09;
+  *p = static_cast(QUICFrameType::STREAM_BLOCKED);
   ++p;
-  QUICTypeUtil::write_uint_as_nbytes(this->_stream_id, 4, p, );
+  QUICTypeUtil::write_QUICStreamId(this->_stream_id, 4, p, );
   p += n;
 
   *len = p - buf;
@@ -1049,7 +1049,7 @@ QUICStreamIdNeededFrame::size() const
 void
 QUICStreamIdNeededFrame::store(uint8_t *buf, size_t *len) const
 {
-  buf[0] = 0x0a;
+  buf[0] = static_cast(QUICFrameType::STREAM_ID_NEEDED);
   *len   = 1;
 }
 
@@ -1080,7 +1080,7 @@ QUICNewConnectionIdFrame::store(uint8_t *buf, size_t 
*len) const
 {
   size_t n;
   uint8_t *p = buf;
-  *p = 0x0b;
+  *p = static_cast(QUICFrameType::NEW_CONNECTION_ID);
   ++p;
   QUICTypeUtil::write_uint_as_nbytes(this->_sequence, 2, p, );
   p += n;
@@ -1352,7 +1352,7 @@ std::unique_ptr<QUICRstStreamFrame, QUICFrameDeleterFunc>
 QUICFrameFactory::create_rst_stream_frame(QUICStreamId stream_id, 
QUICErrorCode error_code, QUICOffset final_offset)
 {
   QUICRstStreamFrame *frame = quicRstStreamFrameAllocator.alloc();
-  new (frame) QUICRstStreamFrame(error_code, stream_id, final_

[trafficserver] branch quic-latest updated: [draft-05] Fix error codes

2017-09-11 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 5241e33  [draft-05] Fix error codes
5241e33 is described below

commit 5241e33e39f690f0a7e42acdaf55f2372ae7337b
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Sep 11 16:55:46 2017 +0900

[draft-05] Fix error codes
---
 iocore/net/QUICNetVConnection.cc|  6 ++---
 iocore/net/quic/QUICDebugNames.cc   | 32 +
 iocore/net/quic/QUICFlowController.cc   |  2 +-
 iocore/net/quic/QUICHandshake.cc|  6 ++---
 iocore/net/quic/QUICStream.cc   |  2 +-
 iocore/net/quic/QUICTypes.h | 28 +++---
 iocore/net/quic/test/test_QUICFlowController.cc |  4 ++--
 iocore/net/quic/test/test_QUICFrame.cc  | 12 +-
 iocore/net/quic/test/test_QUICStreamManager.cc  |  2 +-
 iocore/net/quic/test/test_QUICStreamState.cc|  8 +++
 10 files changed, 68 insertions(+), 34 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index c9654a3..3babca6 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -352,7 +352,7 @@ QUICNetVConnection::state_handshake(int event, Event *data)
   break;
 }
 default:
-  error = QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
+  error = QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::INTERNAL_ERROR);
   break;
 }
 
@@ -538,7 +538,7 @@ 
QUICNetVConnection::_state_handshake_process_initial_client_packet(std::unique_p
 {
   if (packet->size() < MINIMUM_INITIAL_CLIENT_PACKET_SIZE) {
 DebugQUICCon("Packet size is smaller than the minimum initial client 
packet size");
-return QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
+return QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::INTERNAL_ERROR);
   }
 
   // Start handshake
@@ -625,7 +625,7 @@ QUICNetVConnection::_state_common_receive_packet()
 error = this->_state_connection_established_process_packet(std::move(p));
 break;
   default:
-error = QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::QUIC_INTERNAL_ERROR);
+error = QUICError(QUICErrorClass::QUIC_TRANSPORT, 
QUICErrorCode::INTERNAL_ERROR);
 break;
   }
   return error;
diff --git a/iocore/net/quic/QUICDebugNames.cc 
b/iocore/net/quic/QUICDebugNames.cc
index d580be7..2f79b92 100644
--- a/iocore/net/quic/QUICDebugNames.cc
+++ b/iocore/net/quic/QUICDebugNames.cc
@@ -115,15 +115,39 @@ QUICDebugNames::error_code(QUICErrorCode code)
 return "APPLICATION_SPECIFIC_ERROR";
   case QUICErrorCode::HOST_LOCAL_ERROR:
 return "HOST_LOCAL_ERROR";
-  case QUICErrorCode::QUIC_TRANSPORT_ERROR:
-return "QUIC_TRANSPORT_ERROR";
-  case QUICErrorCode::QUIC_INTERNAL_ERROR:
-return "QUIC_INTERNAL_ERROR";
+  case QUICErrorCode::NO_ERROR:
+return "NO_ERROR";
+  case QUICErrorCode::INTERNAL_ERROR:
+return "INTERNAL_ERROR";
+  case QUICErrorCode::CANCELLED:
+return "CANCELLED";
+  case QUICErrorCode::FLOW_CONTROL_ERROR:
+return "FLOW_CONTROL_ERROR";
+  case QUICErrorCode::STREAM_ID_ERROR:
+return "STREAM_ID_ERROR";
+  case QUICErrorCode::STREAM_STATE_ERROR:
+return "STREAM_STATE_ERROR";
+  case QUICErrorCode::FINAL_OFFSET_ERROR:
+return "FINAL_OFFSET_ERROR";
+  case QUICErrorCode::FRAME_FORMAT_ERROR:
+return "FRAME_FORMAT_ERROR";
+  case QUICErrorCode::TRANSPORT_PARAMETER_ERROR:
+return "TRANSPORT_PARAMETER_ERROR";
+  case QUICErrorCode::VERSION_NEGOTIATION_ERROR:
+return "VERSION_NEGOTIATION_ERROR";
+  case QUICErrorCode::PROTOCOL_VIOLATION:
+return "PROTOCOL_VIOLATION";
+  case QUICErrorCode::QUIC_RECEIVED_RST:
+return "QUIC_RECEIVED_RST";
   case QUICErrorCode::CRYPTOGRAPHIC_ERROR:
 return "CRYPTOGRAPHIC_ERROR";
   case QUICErrorCode::TLS_HANDSHAKE_FAILED:
 return "TLS_HANDSHAKE_FAILED";
   default:
+if ((static_cast(code) & 0xFF00) == 
static_cast(QUICErrorCode::FRAME_ERROR)) {
+  // TODO: Add frame type
+  return "FRAME_ERROR";
+}
 return "UNKNOWN";
   }
 }
diff --git a/iocore/net/quic/QUICFlowController.cc 
b/iocore/net/quic/QUICFlowController.cc
index ec277e5..77a615d 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -43,7 +43,7 @@ QUICFlowController::update(QUICOffset offset)
   if (this->_offset <= offset) {
 // Assume flow control is not initialized if the limit was 0
 if (this->_limit 

[trafficserver] branch quic-latest updated: [draft-05] Add STOP_SENDING frame

2017-09-11 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 58bd89f  [draft-05] Add STOP_SENDING frame
58bd89f is described below

commit 58bd89f66df87e359816085a12a49cce4150bba9
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Sep 11 15:11:15 2017 +0900

[draft-05] Add STOP_SENDING frame
---
 iocore/net/quic/QUICFrame.cc   | 72 +-
 iocore/net/quic/QUICFrame.h| 34 
 iocore/net/quic/QUICTypes.h|  2 +
 iocore/net/quic/test/test_QUICFrame.cc | 37 -
 4 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 3ab7a52..c8f2229 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -36,6 +36,7 @@ ClassAllocator 
quicBlockedFrameAllocator("quicBlockedFrameAllo
 ClassAllocator 
quicStreamBlockedFrameAllocator("quicStreamBlockedFrameAllocator");
 ClassAllocator 
quicStreamIdNeededFrameAllocator("quicStreamIdNeededFrameAllocator");
 ClassAllocator 
quicNewConnectionIdFrameAllocator("quicNewConnectionIdFrameAllocator");
+ClassAllocator 
quicStopSendingFrameAllocator("quicStopSendingFrameAllocator");
 ClassAllocator 
quicRetransmissionFrameAllocator("quicRetransmissionFrameAllocator");
 
 QUICFrameType
@@ -44,6 +45,7 @@ QUICFrame::type() const
   return QUICFrame::type(this->_buf);
 }
 
+// XXX QUICFrameType: 0x03 (GOAWAY frame) is removed
 QUICFrameType
 QUICFrame::type(const uint8_t *buf)
 {
@@ -51,7 +53,7 @@ QUICFrame::type(const uint8_t *buf)
 return QUICFrameType::STREAM;
   } else if (buf[0] >= static_cast(QUICFrameType::ACK)) {
 return QUICFrameType::ACK;
-  } else if (static_cast(QUICFrameType::NEW_CONNECTION_ID) < buf[0] 
&& buf[0] < static_cast(QUICFrameType::ACK)) {
+  } else if (buf[0] > static_cast(QUICFrameType::STOP_SENDING) || 
buf[0] == 0x03) {
 return QUICFrameType::UNKNOWN;
   } else {
 return static_cast(buf[0]);
@@ -1109,6 +,62 @@ QUICNewConnectionIdFrame::connection_id() const
 }
 
 //
+// STOP_SENDING frame
+//
+
+QUICStopSendingFrame::QUICStopSendingFrame(QUICStreamId stream_id, 
QUICErrorCode error_code)
+  : _stream_id(stream_id), _error_code(error_code)
+{
+}
+
+QUICFrameType
+QUICStopSendingFrame::type() const
+{
+  return QUICFrameType::STOP_SENDING;
+}
+
+size_t
+QUICStopSendingFrame::size() const
+{
+  return 9;
+}
+
+void
+QUICStopSendingFrame::store(uint8_t *buf, size_t *len) const
+{
+  size_t n;
+  uint8_t *p = buf;
+  *p = static_cast(QUICFrameType::STOP_SENDING);
+  ++p;
+  QUICTypeUtil::write_QUICStreamId(this->_stream_id, 4, p, );
+  p += n;
+  QUICTypeUtil::write_QUICErrorCode(this->_error_code, p, );
+  p += n;
+
+  *len = p - buf;
+}
+
+QUICErrorCode
+QUICStopSendingFrame::error_code() const
+{
+  if (this->_buf) {
+return QUICTypeUtil::read_QUICErrorCode(this->_buf + 5);
+  } else {
+return this->_error_code;
+  }
+}
+
+QUICStreamId
+QUICStopSendingFrame::stream_id() const
+{
+  if (this->_buf) {
+return QUICTypeUtil::read_QUICStreamId(this->_buf + 1, 4);
+  } else {
+return this->_stream_id;
+  }
+}
+
+//
 // QUICRetransmissionFrame
 //
 QUICRetransmissionFrame::QUICRetransmissionFrame(std::unique_ptr<QUICFrame, 
QUICFrameDeleterFunc> original_frame,
@@ -1203,6 +1261,10 @@ QUICFrameFactory::create(const uint8_t *buf, size_t len)
 frame = quicNewConnectionIdFrameAllocator.alloc();
 new (frame) QUICNewConnectionIdFrame(buf, len);
 return std::unique_ptr<QUICFrame, QUICFrameDeleterFunc>(frame, 
::delete_new_connection_id_frame);
+  case QUICFrameType::STOP_SENDING:
+frame = quicStopSendingFrameAllocator.alloc();
+new (frame) QUICStopSendingFrame(buf, len);
+return std::unique_ptr<QUICFrame, QUICFrameDeleterFunc>(frame, 
::delete_stop_sending_frame);
   default:
 // Unknown frame
 return std::unique_ptr<QUICFrame, QUICFrameDeleterFunc>(nullptr, 
::delete_null_frame);
@@ -1294,6 +1356,14 @@ QUICFrameFactory::create_rst_stream_frame(QUICStreamId 
stream_id, QUICErrorCode
   return std::unique_ptr<QUICRstStreamFrame, QUICFrameDeleterFunc>(frame, 
::delete_rst_stream_frame);
 }
 
+std::unique_ptr<QUICStopSendingFrame, QUICFrameDeleterFunc>
+QUICFrameFactory::create_stop_sending_frame(QUICStreamId stream_id, 
QUICErrorCode error_code)
+{
+  QUICStopSendingFrame *frame = quicStopSendingFrameAllocator.alloc();
+  new (frame) QUICStopSendingFrame(stream_id, error_code);
+  return std::unique_ptr<QUICStopSendingFrame, QUICFrameDeleterFunc>(frame, 
::delete_stop_sending_frame);
+}
+
 std::unique_ptr<QUICR

[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 <masa...@apache.org>
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<QUICPacket, QUICPacketDeleterFunc>
 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" <commits@trafficserver.apache.org>'].


[trafficserver] branch quic-latest updated: Rename buffer for received STREAM frame

2017-09-06 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 6d8eee5  Rename buffer for received STREAM frame
6d8eee5 is described below

commit 6d8eee58fb8abdff2e796c0f1a9f12ba64ec37f6
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Wed Sep 6 16:35:15 2017 +0900

Rename buffer for received STREAM frame
---
 iocore/net/quic/QUICStream.cc | 10 +-
 iocore/net/quic/QUICStream.h  |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index c16d0dd..0ca060d 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -267,10 +267,10 @@ QUICStream::_write_to_read_vio(const 
std::shared_ptr 
 void
 QUICStream::_reorder_data()
 {
-  auto frame = _request_stream_frame_buffer.find(this->_recv_offset);
-  while (frame != this->_request_stream_frame_buffer.end()) {
+  auto frame = _received_stream_frame_buffer.find(this->_recv_offset);
+  while (frame != this->_received_stream_frame_buffer.end()) {
 this->_write_to_read_vio(frame->second);
-frame = _request_stream_frame_buffer.find(this->_recv_offset);
+frame = _received_stream_frame_buffer.find(this->_recv_offset);
   }
 }
 
@@ -310,9 +310,9 @@ QUICStream::recv(const std::shared_ptr frame)
 this->_write_to_read_vio(frame);
 this->_reorder_data();
   } else {
-// NOTE: push fragments in _request_stream_frame_buffer temporally.
+// NOTE: push fragments in _received_stream_frame_buffer temporally.
 // They will be reordered when missing data is filled and offset is 
matched.
-this->_request_stream_frame_buffer.insert(std::make_pair(frame->offset(), 
frame));
+this->_received_stream_frame_buffer.insert(std::make_pair(frame->offset(), 
frame));
   }
 
   return QUICError(QUICErrorClass::NONE);
diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h
index 0c3e73b..ff7bb14 100644
--- a/iocore/net/quic/QUICStream.h
+++ b/iocore/net/quic/QUICStream.h
@@ -105,7 +105,7 @@ private:
 
   // Fragments of received STREAM frame (offset is unmatched)
   // TODO: Consider to replace with ts/RbTree.h or other data structure
-  std::map<QUICOffset, std::shared_ptr> 
_request_stream_frame_buffer;
+  std::map<QUICOffset, std::shared_ptr> 
_received_stream_frame_buffer;
 
   QUICStreamManager *_stream_manager = nullptr;
   QUICFrameTransmitter *_tx  = nullptr;

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <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 <masa...@apache.org>
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<QUICPacket, 
QUICPacketDeleterFunc> 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<int64_t, QUICNetVConnection *> _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<QUICPacket, 
QUICPacketDeleterFunc> 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<QUICPacket,
 QUICPacketDeleterFunc> 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_

[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 <masa...@apache.org>
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" <commits@trafficserver.apache.org>'].


[trafficserver] branch quic-latest updated (2786a2c -> 0952de7)

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

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


from 2786a2c  Remove send_frame from QUICStreamManager
 new b3c9706  Change default error_code to QUICErrorCode::NO_ERROR
 new 3bfc675  Schedule QUIC_EVENT_SHUTDOWN when change state to 
state_connection_closed
 new 0952de7  Add QUICDebugNames::quic_event(int)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/QUICNetVConnection.cc  | 16 +++-
 iocore/net/quic/QUICDebugNames.cc | 17 +
 iocore/net/quic/QUICDebugNames.h  |  2 ++
 iocore/net/quic/QUICEvents.h  |  2 ++
 iocore/net/quic/QUICTypes.h   |  4 ++--
 5 files changed, 30 insertions(+), 11 deletions(-)

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


  1   2   3   4   5   6   7   8   9   10   >