You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/03/28 21:35:58 UTC
[1/2] qpid-proton git commit: PROTON-1537: [ruby] Fix all -W2
warnings in self-tests
Repository: qpid-proton
Updated Branches:
refs/heads/master 9fab77194 -> e8de49d33
PROTON-1537: [ruby] Fix all -W2 warnings in self-tests
Removed excessive -W0 warning suppressions in CMakeLists, fixed all warnings in 'ctest -V -R ruby'
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0f0de8d6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0f0de8d6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0f0de8d6
Branch: refs/heads/master
Commit: 0f0de8d67ce0d438c18750c30adfece9d568ae7c
Parents: 9fab771
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Mar 28 16:52:02 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Mar 28 17:25:09 2018 -0400
----------------------------------------------------------------------
proton-c/bindings/ruby/CMakeLists.txt | 9 +++++----
proton-c/bindings/ruby/lib/core/message.rb | 4 +++-
proton-c/bindings/ruby/spec/hash_spec.rb | 6 +++---
proton-c/bindings/ruby/spec/message_spec.rb | 1 -
proton-c/bindings/ruby/spec/spec_helper.rb | 2 --
proton-c/bindings/ruby/tests/test_interop.rb | 2 +-
proton-c/bindings/ruby/tests/test_messaging_adapter.rb | 2 +-
7 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/CMakeLists.txt b/proton-c/bindings/ruby/CMakeLists.txt
index f6f95f7..ca7c161 100644
--- a/proton-c/bindings/ruby/CMakeLists.txt
+++ b/proton-c/bindings/ruby/CMakeLists.txt
@@ -114,14 +114,11 @@ if (result EQUAL 0) # Have minitest
set(test_env ${env_py} -- "PATH=${PATH}" "RUBYLIB=${RUBYLIB}" "SASLPASSWD=${SASLPASSWD_EXE}")
macro(add_ruby_test script)
- if(${script} MATCHES "old")
- set(opt "RUBYOPT=-W0") # Suppress deprecation warnings
- endif()
get_filename_component(name ${script} NAME_WE)
string(REPLACE "_" "-" name "ruby-${name}")
add_test(
NAME ${name}
- COMMAND ${test_env} ${opt} ${RUBY_EXECUTABLE} ${script} -v
+ COMMAND ${test_env} ${RUBY_EXECUTABLE} ${script} -v
${ARGN})
endmacro()
@@ -132,6 +129,10 @@ if (result EQUAL 0) # Have minitest
foreach(t ${TESTS} ${SPECS})
add_ruby_test(${t})
endforeach()
+ # Suppress deprecation warnings from backward-compatibility tests
+ set_tests_properties(
+ ruby-old-example-test ruby-test-old-adapter
+ PROPERTIES ENVIRONMENT "RUBYOPT=-W0")
else()
# No minitest
message(STATUS "Ruby tests will not run, minitest is not installed")
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/lib/core/message.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/message.rb b/proton-c/bindings/ruby/lib/core/message.rb
index 9f83cfd..0256387 100644
--- a/proton-c/bindings/ruby/lib/core/message.rb
+++ b/proton-c/bindings/ruby/lib/core/message.rb
@@ -70,7 +70,6 @@ module Qpid::Proton
end
end
- # @private nill
# @private
def pre_encode
# encode elements from the message
@@ -89,6 +88,7 @@ module Qpid::Proton
@properties = {}
@instructions = {}
@annotations = {}
+ @body = nil
self.body = body unless body.nil?
if !opts.nil? then
opts.each do |k, v|
@@ -504,6 +504,8 @@ module Qpid::Proton
# @return [Object] body of the message.
attr_accessor :body
+ def inspect() pre_encode; super; end
+
private
def check(err) # :nodoc:
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/spec/hash_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/hash_spec.rb b/proton-c/bindings/ruby/spec/hash_spec.rb
index 8ef4177..d9e07c1 100644
--- a/proton-c/bindings/ruby/spec/hash_spec.rb
+++ b/proton-c/bindings/ruby/spec/hash_spec.rb
@@ -27,8 +27,8 @@ describe "The extended hash type" do
end
it "can be put into an instance of Data" do
- @hash.proton_data_put(@data)
- result = Hash.proton_data_get(@data)
+ @data.map = @hash
+ result = @data.map
result.keys.must_equal(@hash.keys)
result.values.must_equal(@hash.values)
end
@@ -38,7 +38,7 @@ describe "The extended hash type" do
@data.rewind
proc {
- Hash.proton_data_get(@data)
+ @data.map
}.must_raise(TypeError)
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/spec/message_spec.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/message_spec.rb b/proton-c/bindings/ruby/spec/message_spec.rb
index eacabcc..5383f5a 100644
--- a/proton-c/bindings/ruby/spec/message_spec.rb
+++ b/proton-c/bindings/ruby/spec/message_spec.rb
@@ -580,7 +580,6 @@ module Qpid
end
it "has no body after being cleared" do
- name = random_string(16)
value = random_string(128)
@message.body = value
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/spec/spec_helper.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/spec/spec_helper.rb b/proton-c/bindings/ruby/spec/spec_helper.rb
index 809da52..fd5f288 100644
--- a/proton-c/bindings/ruby/spec/spec_helper.rb
+++ b/proton-c/bindings/ruby/spec/spec_helper.rb
@@ -17,7 +17,6 @@
# under the License.
#
-require 'minitest/spec'
require 'minitest/autorun'
require "securerandom"
require "qpid_proton"
@@ -65,7 +64,6 @@ end
def random_list(length)
result = []
(0...length).each do |element|
- type = rand(8192) % 4
low = rand(512)
high = rand(8192)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/tests/test_interop.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_interop.rb b/proton-c/bindings/ruby/tests/test_interop.rb
index a956fc8..ff85e76 100755
--- a/proton-c/bindings/ruby/tests/test_interop.rb
+++ b/proton-c/bindings/ruby/tests/test_interop.rb
@@ -23,7 +23,7 @@ class InteropTest < MiniTest::Test
# Walk up the directory tree to find the tests directory.
def get_data(name)
path = File.join(File.dirname(__FILE__), "../../../../tests/interop/#{name}.amqp")
- raise "Can't find test/interop directory from #{__FILE__}" unless File.exists?(path)
+ raise "Can't find test/interop directory from #{__FILE__}" unless File.exist?(path)
File.open(path, "rb") { |f| f.read }
end
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0f0de8d6/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_messaging_adapter.rb b/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
index 942fc01..70ec0ca 100644
--- a/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
+++ b/proton-c/bindings/ruby/tests/test_messaging_adapter.rb
@@ -112,7 +112,7 @@ class TestMessagingHandler < MiniTest::Test
def test_session_error
d = DriverPair.new(RecordingHandler.new, RecordingHandler.new)
d.client.connection.open
- s = d.client.connection.session; s.open; d.run
+ s = d.client.connection.default_session; s.open; d.run
assert_equal [:on_connection_open, :on_session_open], d.client.handler.names
assert_equal [:on_connection_open, :on_session_open], d.server.handler.names
d.clear
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-proton git commit: PROTON-1809: Unable to receive messages
when max-frame-size > 2^20
Posted by ac...@apache.org.
PROTON-1809: Unable to receive messages when max-frame-size > 2^20
The C transport code was computing the session incoming window as
session_capacity/max_frame_size, resulting in an incoming window that was always
0 if the frame size was bigger than session_capacity (default 2^20)
Fixes:
1. Removed the default session-capacity. Session flow control is only enabled
if session-capacity and max-frame-size are *both* explicitly set.
2. If the specified session capacity is less than max-frame-size, it is
automatically increased to be equal to max-frame-size to ensure at least one
frame can be received.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e8de49d3
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e8de49d3
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e8de49d3
Branch: refs/heads/master
Commit: e8de49d33b1c750327e6c9a090332953a7669a4d
Parents: 0f0de8d
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Mar 28 14:33:10 2018 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Mar 28 17:25:41 2018 -0400
----------------------------------------------------------------------
proton-c/src/core/engine.c | 5 +++--
proton-c/src/core/framing.h | 1 +
proton-c/src/core/transport.c | 8 +++++---
3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e8de49d3/proton-c/src/core/engine.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/engine.c b/proton-c/src/core/engine.c
index f49886d..070c751 100644
--- a/proton-c/src/core/engine.c
+++ b/proton-c/src/core/engine.c
@@ -20,6 +20,7 @@
*/
#include "engine-internal.h"
+#include "framing.h"
#include <stdlib.h>
#include <string.h>
#include "protocol.h"
@@ -987,12 +988,12 @@ pn_session_t *pn_session(pn_connection_t *conn)
ssn->links = pn_list(PN_WEAKREF, 0);
ssn->freed = pn_list(PN_WEAKREF, 0);
ssn->context = pn_record();
- ssn->incoming_capacity = 1024*1024;
+ ssn->incoming_capacity = 0;
ssn->incoming_bytes = 0;
ssn->outgoing_bytes = 0;
ssn->incoming_deliveries = 0;
ssn->outgoing_deliveries = 0;
- ssn->outgoing_window = 2147483647;
+ ssn->outgoing_window = AMQP_MAX_WINDOW_SIZE;
// begin transport state
memset(&ssn->state, 0, sizeof(ssn->state));
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e8de49d3/proton-c/src/core/framing.h
----------------------------------------------------------------------
diff --git a/proton-c/src/core/framing.h b/proton-c/src/core/framing.h
index 792d664..92c1f7d 100644
--- a/proton-c/src/core/framing.h
+++ b/proton-c/src/core/framing.h
@@ -30,6 +30,7 @@
#define AMQP_HEADER_SIZE (8)
#define AMQP_MIN_MAX_FRAME_SIZE ((uint32_t)512) // minimum allowable max-frame
+#define AMQP_MAX_WINDOW_SIZE (2147483647)
typedef struct {
uint8_t type;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e8de49d3/proton-c/src/core/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/transport.c b/proton-c/src/core/transport.c
index 96b54f2..b722991 100644
--- a/proton-c/src/core/transport.c
+++ b/proton-c/src/core/transport.c
@@ -1894,10 +1894,12 @@ static size_t pni_session_outgoing_window(pn_session_t *ssn)
static size_t pni_session_incoming_window(pn_session_t *ssn)
{
uint32_t size = ssn->connection->transport->local_max_frame;
- if (!size) {
- return 2147483647; // biggest legal value
+ size_t cap = ssn->incoming_capacity;
+ if (size && cap) { /* session flow control is enabled if both are specified */
+ if (cap < size) ssn->incoming_capacity = size; /* Must be able to hold 1 frame */
+ return (ssn->incoming_capacity - ssn->incoming_bytes) / size;
} else {
- return (ssn->incoming_capacity - ssn->incoming_bytes)/size;
+ return AMQP_MAX_WINDOW_SIZE;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org