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 2017/02/23 22:43:14 UTC

[1/6] qpid-proton git commit: Revert "NO-JIRA: go binding build results in binary dir, not source dir"

Repository: qpid-proton
Updated Branches:
  refs/heads/master 204c8474d -> c94301d59


Revert "NO-JIRA: go binding build results in binary dir, not source dir"

This reverts commit 9bd99ebf096ed83bd23ae05fe9cc0e6f65d9ac2e.

Copying sources into the bin dir for compliation is a bad idea:
- compile errors are located in the binary copy, not the source
- deleted source files are not reflected in the binary copy

Need a better solution.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/5d1c2479
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/5d1c2479
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/5d1c2479

Branch: refs/heads/master
Commit: 5d1c24796a0411e659e082e81171cde511b04f02
Parents: 204c847
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Feb 23 09:05:39 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 23 13:46:57 2017 -0500

----------------------------------------------------------------------
 .gitignore                          |  7 +++++++
 examples/go/CMakeLists.txt          |  8 +++++---
 proton-c/bindings/go/CMakeLists.txt | 17 +++++++++--------
 3 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d1c2479/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index b769990..aa9bc36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,9 +31,16 @@ eclipse-classes
 # The usual location for proton-c build files
 proton-c/build
 
+# Executables built by go binding tests
+proton-c/bindings/go/bin
+
 # Testresults from the jenkins build script
 testresults
 
+# Go binding build output
+/proton-c/bindings/go/pkg
+/proton-c/bindings/go/bin
+
 # Python TOX test build output
 /proton-c/bindings/python/MANIFEST
 /proton-c/bindings/python/build

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d1c2479/examples/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/go/CMakeLists.txt b/examples/go/CMakeLists.txt
index 861cdd8..c9aba01 100644
--- a/examples/go/CMakeLists.txt
+++ b/examples/go/CMakeLists.txt
@@ -20,11 +20,12 @@
 if(BUILD_GO)
 
   set(examples electron/broker electron/receive electron/send proton/broker)
+  file(GLOB_RECURSE example_source FOLLOW_SYMLINKS ${CMAKE_CURRENT_SOURCE_DIR}/*.go)
 
   # Build example exes
   foreach(example ${examples})
-    string(REPLACE / - target ${example})
-    set(target "go-example-${target}")
+    string(REPLACE / _ target ${example})
+    set(target "go_example_${target}")
     set(output ${CMAKE_CURRENT_BINARY_DIR}/${example})
     # Always run go_build, it will do nothing if there is nothing to do.
     # Otherwise it's too hard to get the dependencies right.
@@ -32,11 +33,12 @@ if(BUILD_GO)
       COMMAND ${GO_BUILD} ${GO_EXAMPLE_FLAGS} -o ${output} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.go
       WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
       DEPENDS go-build)
+    list(APPEND example_targets ${target})
   endforeach()
 
   # Build test driver exe
   set(test_exe ${CMAKE_CURRENT_BINARY_DIR}/example_test)
-  add_custom_target(go-example-test ALL
+  add_custom_target(go_example_test ALL
     COMMAND ${GO_TEST} -c -o ${test_exe} ${CMAKE_CURRENT_SOURCE_DIR}/example_test.go
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/5d1c2479/proton-c/bindings/go/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/CMakeLists.txt b/proton-c/bindings/go/CMakeLists.txt
index 1cb9d6c..d0ffe9b 100644
--- a/proton-c/bindings/go/CMakeLists.txt
+++ b/proton-c/bindings/go/CMakeLists.txt
@@ -26,6 +26,7 @@ set(GO_TEST_FLAGS "-v" CACHE STRING "Flags for 'go test'")
 
 # Flags that differ for golang go and gcc go.
 if (go_ver MATCHES "gccgo")
+  # TODO aconway 2015-10-08: import cycles with -race under gccgo, investigate.
   set(GO_RPATH_FLAGS -gccgoflags "-Wl,-rpath=${CMAKE_BINARY_DIR}/proton-c")
 else()
   set(GO_RPATH_FLAGS -ldflags "-r ${CMAKE_BINARY_DIR}/proton-c")
@@ -36,7 +37,7 @@ separate_arguments(GO_TEST_FLAGS)
 
 # Following are CACHE INTERNAL so examples/CMakeLists.txt can see them.
 set(GO_ENV ${env_py} --
-  "GOPATH=${CMAKE_CURRENT_BINARY_DIR}"
+  "GOPATH=${CMAKE_CURRENT_SOURCE_DIR}"
   "CGO_CFLAGS=-I${CMAKE_SOURCE_DIR}/proton-c/include -I${CMAKE_BINARY_DIR}/proton-c/include"
   "CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/proton-c"
   "PN_INTEROP_DIR=${CMAKE_SOURCE_DIR}/tests/interop"
@@ -46,15 +47,15 @@ set(GO ${GO_ENV} ${GO_EXE} CACHE INTERNAL "Run go with environment set")
 
 set(GO_BUILD ${GO} build ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run go build")
 set(GO_INSTALL ${GO} install ${GO_BUILD_FLAGS} CACHE INTERNAL "Run go install" )
-set(GO_TEST ${GO} test ${GO_TEST_FLAGS} ${GO_RPATH_FLAGS} CACHE INTERNAL "Run go test")
+set(GO_TEST ${GO} test ${GO_BUILD_FLAGS} ${GO_RPATH_FLAGS} ${GO_TEST_FLAGS} CACHE INTERNAL "Run go test")
 
-# The go build tools handle dependency checks and incremental builds better than CMake so
-# just run them every time, they do nothing if nothing needs to be done.
-#
-# The Go sources are copied to the binary directory so we can respect the standard Go tree
-# layout without polluting the source tree.
+# Go tools insist on standard Go layout which puts compiled code in the source tree :(
+# Build output is all under git-ignored pkg or bin subdirectories, they are removed by make clean.
+
+# The go build tools handle dependency checks and incremental builds better than
+# CMake so just run them every time, they do nothing if nothing needs to be
+# done.
 add_custom_target(go-build ALL
-  COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/src
   COMMAND ${GO_INSTALL} qpid.apache.org/...
   DEPENDS qpid-proton-core
   WORKING_DIRECTORY $ENV{PWD})


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[5/6] qpid-proton git commit: PROTON-1415: go fix conversion of pn_seconds_t

Posted by ac...@apache.org.
PROTON-1415: go fix conversion of pn_seconds_t

genwrap.go: fix conversion of pn_seconds_t to time.Duration.
Exposed by adding TerminusSettings which includes a pn_seconds_t Timeout value.
This is the only place pn_seconds_t is used for a duration in proton instead of pn_millis_t.


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

Branch: refs/heads/master
Commit: c87b23ef7b473cd48e8775ed9c353d042d99f3ca
Parents: 38592d1
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Feb 23 15:37:24 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 23 15:37:24 2017 -0500

----------------------------------------------------------------------
 proton-c/bindings/go/genwrap.go                 |  6 ++--
 .../src/qpid.apache.org/electron/link_test.go   |  3 +-
 .../src/qpid.apache.org/proton/wrappers_gen.go  | 35 +++++++++++++++++++-
 3 files changed, 38 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c87b23ef/proton-c/bindings/go/genwrap.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/genwrap.go b/proton-c/bindings/go/genwrap.go
index 7782b0b..6885b74 100644
--- a/proton-c/bindings/go/genwrap.go
+++ b/proton-c/bindings/go/genwrap.go
@@ -161,10 +161,7 @@ func panicIf(err error) {
 }
 
 func readHeader(name string) string {
-	file, err := os.Open(path.Join(includeProton, name+".h"))
-	panicIf(err)
-	defer file.Close()
-	s, err := ioutil.ReadAll(file)
+	s, err := ioutil.ReadFile(path.Join(includeProton, name+".h"))
 	panicIf(err)
 	return string(s)
 }
@@ -314,6 +311,7 @@ func mapType(ctype string) (g genType) {
 	case "C.pn_seconds_t":
 		g.Gotype = "time.Duration"
 		g.ToGo = func(v string) string { return fmt.Sprintf("(time.Duration(%s) * time.Second)", v) }
+		g.ToC = func(v string) string { return fmt.Sprintf("C.pn_seconds_t(%s/time.Second)", v) }
 	case "C.pn_millis_t":
 		g.Gotype = "time.Duration"
 		g.ToGo = func(v string) string { return fmt.Sprintf("(time.Duration(%s) * time.Millisecond)", v) }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c87b23ef/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go b/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
index eb49c47..133faad 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
@@ -24,13 +24,14 @@ import (
 	"net"
 	"qpid.apache.org/proton"
 	"testing"
+	"time"
 )
 
 func TestLinkSettings(t *testing.T) {
 	cConn, sConn := net.Pipe()
 	done := make(chan error)
 	// FIXME aconway 2017-02-23: bug in timeout conversion (pn_second_t)
-	settings := TerminusSettings{Durability: 1, Expiry: 2 /*, Timeout: 42 * time.Second*/, Dynamic: true}
+	settings := TerminusSettings{Durability: 1, Expiry: 2, Timeout: 42 * time.Second, Dynamic: true}
 	go func() { // Server
 		close(done)
 		defer sConn.Close()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c87b23ef/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
index 19bfde2..a6c6635 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
@@ -78,6 +78,13 @@ const (
 	ETransportHeadClosed    EventType = C.PN_TRANSPORT_HEAD_CLOSED
 	ETransportTailClosed    EventType = C.PN_TRANSPORT_TAIL_CLOSED
 	ETransportClosed        EventType = C.PN_TRANSPORT_CLOSED
+	EConnectionWake         EventType = C.PN_CONNECTION_WAKE
+	EListenerAccept         EventType = C.PN_LISTENER_ACCEPT
+	EListenerClose          EventType = C.PN_LISTENER_CLOSE
+	EProactorInterrupt      EventType = C.PN_PROACTOR_INTERRUPT
+	EProactorTimeout        EventType = C.PN_PROACTOR_TIMEOUT
+	EProactorInactive       EventType = C.PN_PROACTOR_INACTIVE
+	EListenerOpen           EventType = C.PN_LISTENER_OPEN
 )
 
 func (e EventType) String() string {
@@ -143,6 +150,20 @@ func (e EventType) String() string {
 		return "TransportTailClosed"
 	case C.PN_TRANSPORT_CLOSED:
 		return "TransportClosed"
+	case C.PN_CONNECTION_WAKE:
+		return "ConnectionWake"
+	case C.PN_LISTENER_ACCEPT:
+		return "ListenerAccept"
+	case C.PN_LISTENER_CLOSE:
+		return "ListenerClose"
+	case C.PN_PROACTOR_INTERRUPT:
+		return "ProactorInterrupt"
+	case C.PN_PROACTOR_TIMEOUT:
+		return "ProactorTimeout"
+	case C.PN_PROACTOR_INACTIVE:
+		return "ProactorInactive"
+	case C.PN_LISTENER_OPEN:
+		return "ListenerOpen"
 	}
 	return "Unknown"
 }
@@ -352,6 +373,15 @@ func (l Link) SetDrain(drain bool) {
 func (l Link) Draining() bool {
 	return bool(C.pn_link_draining(l.pn))
 }
+func (l Link) MaxMessageSize() uint64 {
+	return uint64(C.pn_link_max_message_size(l.pn))
+}
+func (l Link) SetMaxMessageSize(size uint64) {
+	C.pn_link_set_max_message_size(l.pn, C.uint64_t(size))
+}
+func (l Link) RemoteMaxMessageSize() uint64 {
+	return uint64(C.pn_link_remote_max_message_size(l.pn))
+}
 
 // Wrappers for declarations in delivery.h
 
@@ -499,6 +529,9 @@ func (c Condition) RedirectHost() string {
 func (c Condition) RedirectPort() int {
 	return int(C.pn_condition_redirect_port(c.pn))
 }
+func (c Condition) Copy(src Condition) int {
+	return int(C.pn_condition_copy(c.pn, src.pn))
+}
 
 // Wrappers for declarations in terminus.h
 
@@ -630,7 +663,7 @@ func (t Terminus) Timeout() time.Duration {
 	return (time.Duration(C.pn_terminus_get_timeout(t.pn)) * time.Second)
 }
 func (t Terminus) SetTimeout(timeout time.Duration) int {
-	return int(C.pn_terminus_set_timeout(t.pn, C.pn_seconds_t(timeout)))
+	return int(C.pn_terminus_set_timeout(t.pn, C.pn_seconds_t(timeout/time.Second)))
 }
 func (t Terminus) IsDynamic() bool {
 	return bool(C.pn_terminus_is_dynamic(t.pn))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[4/6] qpid-proton git commit: PROTON-1415: go binding does not create durable subscriber

Posted by ac...@apache.org.
PROTON-1415: go binding does not create durable subscriber

Added `DurableSubscription(name string) LinkOption`, pass to Connection.Receiver()
to create a named durable subscription.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/38592d16
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/38592d16
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/38592d16

Branch: refs/heads/master
Commit: 38592d1668eef9d192ed0c814b34e807039777d3
Parents: 540e74e
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Feb 23 14:02:14 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 23 15:30:05 2017 -0500

----------------------------------------------------------------------
 .../src/qpid.apache.org/electron/connection.go  |   2 +-
 .../go/src/qpid.apache.org/electron/link.go     | 128 ++++++++++++++-----
 .../src/qpid.apache.org/electron/link_test.go   |  63 +++++++++
 3 files changed, 160 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38592d16/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
index 7f3050f..8f62491 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
@@ -276,7 +276,7 @@ func (c *connection) WaitTimeout(timeout time.Duration) error {
 }
 
 func (c *connection) Incoming() <-chan Incoming {
-	assert(c.incoming != nil, "electron.Connection.Incoming() disabled for %s", c)
+	assert(c.incoming != nil, "Incoming() is only allowed for a Connection created with the Server() option: %s", c)
 	return c.incoming
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38592d16/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/link.go b/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
index 1d17894..4f927c1 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
@@ -22,6 +22,7 @@ package electron
 import (
 	"fmt"
 	"qpid.apache.org/proton"
+	"time"
 )
 
 // Settings associated with a link
@@ -50,6 +51,12 @@ type LinkSettings interface {
 
 	// Session containing the Link
 	Session() Session
+
+	// Advanced settings for the source
+	SourceSettings() TerminusSettings
+
+	// Advanced settings for the target
+	TargetSettings() TerminusSettings
 }
 
 // LinkOption can be passed when creating a sender or receiver link to set optional configuration.
@@ -62,7 +69,7 @@ func Source(s string) LinkOption { return func(l *linkSettings) { l.source = s }
 func Target(s string) LinkOption { return func(l *linkSettings) { l.target = s } }
 
 // LinkName returns a LinkOption that sets the link name.
-func LinkName(s string) LinkOption { return func(l *linkSettings) { l.target = s } }
+func LinkName(s string) LinkOption { return func(l *linkSettings) { l.linkName = s } }
 
 // SndSettle returns a LinkOption that sets the send settle mode
 func SndSettle(m SndSettleMode) LinkOption { return func(l *linkSettings) { l.sndSettle = m } }
@@ -70,16 +77,23 @@ func SndSettle(m SndSettleMode) LinkOption { return func(l *linkSettings) { l.sn
 // RcvSettle returns a LinkOption that sets the send settle mode
 func RcvSettle(m RcvSettleMode) LinkOption { return func(l *linkSettings) { l.rcvSettle = m } }
 
-// SndSettleMode returns a LinkOption that defines when the sending end of the
-// link settles message delivery.
-type SndSettleMode proton.SndSettleMode
-
 // Capacity returns a LinkOption that sets the link capacity
 func Capacity(n int) LinkOption { return func(l *linkSettings) { l.capacity = n } }
 
 // Prefetch returns a LinkOption that sets a receivers pre-fetch flag. Not relevant for a sender.
 func Prefetch(p bool) LinkOption { return func(l *linkSettings) { l.prefetch = p } }
 
+// DurableSubscription returns a LinkOption that configures a Receiver as a named durable
+// subscription.  The name overrides (and is overridden by) LinkName() so you should normally
+// only use one of these options.
+func DurableSubscription(name string) LinkOption {
+	return func(l *linkSettings) {
+		l.linkName = name
+		l.sourceSettings.Durability = proton.Deliveries
+		l.sourceSettings.Expiry = proton.ExpireNever
+	}
+}
+
 // AtMostOnce returns a LinkOption that sets "fire and forget" mode, messages
 // are sent but no acknowledgment is received, messages can be lost if there is
 // a network failure. Sets SndSettleMode=SendSettled and RcvSettleMode=RcvFirst
@@ -102,6 +116,21 @@ func AtLeastOnce() LinkOption {
 	}
 }
 
+// SourceSettings returns a LinkOption that sets all the SourceSettings.
+// Note: it will override the source address set by a Source() option
+func SourceSettings(ts TerminusSettings) LinkOption {
+	return func(l *linkSettings) { l.sourceSettings = ts }
+}
+
+// TargetSettings returns a LinkOption that sets all the TargetSettings.
+// Note: it will override the target address set by a Target() option
+func TargetSettings(ts TerminusSettings) LinkOption {
+	return func(l *linkSettings) { l.targetSettings = ts }
+}
+
+// SndSettleMode defines when the sending end of the link settles message delivery.
+type SndSettleMode proton.SndSettleMode
+
 const (
 	// Messages are sent unsettled
 	SndUnsettled = SndSettleMode(proton.SndUnsettled)
@@ -122,16 +151,37 @@ const (
 )
 
 type linkSettings struct {
-	source    string
-	target    string
-	linkName  string
-	isSender  bool
-	sndSettle SndSettleMode
-	rcvSettle RcvSettleMode
-	capacity  int
-	prefetch  bool
-	session   *session
-	pLink     proton.Link
+	source         string
+	sourceSettings TerminusSettings
+	target         string
+	targetSettings TerminusSettings
+	linkName       string
+	isSender       bool
+	sndSettle      SndSettleMode
+	rcvSettle      RcvSettleMode
+	capacity       int
+	prefetch       bool
+	session        *session
+	pLink          proton.Link
+}
+
+// Advanced AMQP settings for the source or target of a link.
+// Usually these can be set via a more descriptive LinkOption, e.g. DurableSubscription()
+// and do not need to be set/examined directly.
+type TerminusSettings struct {
+	Durability proton.Durability
+	Expiry     proton.ExpiryPolicy
+	Timeout    time.Duration
+	Dynamic    bool
+}
+
+func makeTerminusSettings(t proton.Terminus) TerminusSettings {
+	return TerminusSettings{
+		Durability: t.Durability(),
+		Expiry:     t.ExpiryPolicy(),
+		Timeout:    t.Timeout(),
+		Dynamic:    t.IsDynamic(),
+	}
 }
 
 type link struct {
@@ -139,13 +189,15 @@ type link struct {
 	linkSettings
 }
 
-func (l *linkSettings) Source() string           { return l.source }
-func (l *linkSettings) Target() string           { return l.target }
-func (l *linkSettings) LinkName() string         { return l.linkName }
-func (l *linkSettings) IsSender() bool           { return l.isSender }
-func (l *linkSettings) IsReceiver() bool         { return !l.isSender }
-func (l *linkSettings) SndSettle() SndSettleMode { return l.sndSettle }
-func (l *linkSettings) RcvSettle() RcvSettleMode { return l.rcvSettle }
+func (l *linkSettings) Source() string                   { return l.source }
+func (l *linkSettings) Target() string                   { return l.target }
+func (l *linkSettings) LinkName() string                 { return l.linkName }
+func (l *linkSettings) IsSender() bool                   { return l.isSender }
+func (l *linkSettings) IsReceiver() bool                 { return !l.isSender }
+func (l *linkSettings) SndSettle() SndSettleMode         { return l.sndSettle }
+func (l *linkSettings) RcvSettle() RcvSettleMode         { return l.rcvSettle }
+func (l *linkSettings) SourceSettings() TerminusSettings { return l.sourceSettings }
+func (l *linkSettings) TargetSettings() TerminusSettings { return l.targetSettings }
 
 func (l *link) Session() Session       { return l.session }
 func (l *link) Connection() Connection { return l.session.Connection() }
@@ -175,7 +227,17 @@ func makeLocalLink(sn *session, isSender bool, setting ...LinkOption) (linkSetti
 		return l, fmt.Errorf("cannot create link %s", l.pLink)
 	}
 	l.pLink.Source().SetAddress(l.source)
+	l.pLink.Source().SetDurability(l.sourceSettings.Durability)
+	l.pLink.Source().SetExpiryPolicy(l.sourceSettings.Expiry)
+	l.pLink.Source().SetTimeout(l.sourceSettings.Timeout)
+	l.pLink.Source().SetDynamic(l.sourceSettings.Dynamic)
+
 	l.pLink.Target().SetAddress(l.target)
+	l.pLink.Target().SetDurability(l.targetSettings.Durability)
+	l.pLink.Target().SetExpiryPolicy(l.targetSettings.Expiry)
+	l.pLink.Target().SetTimeout(l.targetSettings.Timeout)
+	l.pLink.Target().SetDynamic(l.targetSettings.Dynamic)
+
 	l.pLink.SetSndSettleMode(proton.SndSettleMode(l.sndSettle))
 	l.pLink.SetRcvSettleMode(proton.RcvSettleMode(l.rcvSettle))
 	l.pLink.Open()
@@ -184,16 +246,18 @@ func makeLocalLink(sn *session, isSender bool, setting ...LinkOption) (linkSetti
 
 func makeIncomingLinkSettings(pLink proton.Link, sn *session) linkSettings {
 	return linkSettings{
-		isSender:  pLink.IsSender(),
-		source:    pLink.RemoteSource().Address(),
-		target:    pLink.RemoteTarget().Address(),
-		linkName:  pLink.Name(),
-		sndSettle: SndSettleMode(pLink.RemoteSndSettleMode()),
-		rcvSettle: RcvSettleMode(pLink.RemoteRcvSettleMode()),
-		capacity:  1,
-		prefetch:  false,
-		pLink:     pLink,
-		session:   sn,
+		isSender:       pLink.IsSender(),
+		source:         pLink.RemoteSource().Address(),
+		sourceSettings: makeTerminusSettings(pLink.RemoteSource()),
+		target:         pLink.RemoteTarget().Address(),
+		targetSettings: makeTerminusSettings(pLink.RemoteTarget()),
+		linkName:       pLink.Name(),
+		sndSettle:      SndSettleMode(pLink.RemoteSndSettleMode()),
+		rcvSettle:      RcvSettleMode(pLink.RemoteRcvSettleMode()),
+		capacity:       1,
+		prefetch:       false,
+		pLink:          pLink,
+		session:        sn,
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/38592d16/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go b/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
new file mode 100644
index 0000000..eb49c47
--- /dev/null
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/link_test.go
@@ -0,0 +1,63 @@
+/*
+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.
+*/
+
+// Test that link settings are propagated correctly
+package electron
+
+import (
+	"net"
+	"qpid.apache.org/proton"
+	"testing"
+)
+
+func TestLinkSettings(t *testing.T) {
+	cConn, sConn := net.Pipe()
+	done := make(chan error)
+	// FIXME aconway 2017-02-23: bug in timeout conversion (pn_second_t)
+	settings := TerminusSettings{Durability: 1, Expiry: 2 /*, Timeout: 42 * time.Second*/, Dynamic: true}
+	go func() { // Server
+		close(done)
+		defer sConn.Close()
+		c, err := NewConnection(sConn, Server())
+		fatalIf(t, err)
+		for in := range c.Incoming() {
+			ep := in.Accept()
+			switch ep := ep.(type) {
+			case Receiver:
+				errorIf(t, checkEqual("one.source", ep.Source()))
+				errorIf(t, checkEqual(TerminusSettings{}, ep.SourceSettings()))
+				errorIf(t, checkEqual("one.target", ep.Target()))
+				errorIf(t, checkEqual(settings, ep.TargetSettings()))
+			case Sender:
+				errorIf(t, checkEqual("two", ep.LinkName()))
+				errorIf(t, checkEqual("two.source", ep.Source()))
+				errorIf(t, checkEqual(TerminusSettings{Durability: proton.Deliveries, Expiry: proton.ExpireNever}, ep.SourceSettings()))
+			}
+		}
+	}()
+
+	// Client
+	c, err := NewConnection(cConn)
+	fatalIf(t, err)
+	c.Sender(Source("one.source"), Target("one.target"), TargetSettings(settings))
+
+	c.Receiver(Source("two.source"), DurableSubscription("two"))
+	c.Close(nil)
+	<-done
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[6/6] qpid-proton git commit: NO-JIRA: go wrappers re-generated to be compatible with proton-c 0.10

Posted by ac...@apache.org.
NO-JIRA: go wrappers re-generated to be compatible with proton-c 0.10

Some new definitions had creeped into the wrappers_gen.go that would fail to
build with older versions of proton-c.

Updated genwrap.go:
- -include option generates from installed headers instead of git source
- explicitly include the intended minimum C version
- fail attempts to generate from newer headers

Added test-versions.sh, takes a list of install prefixes where proton is
installed and runs go test on the git go sources against each one.


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

Branch: refs/heads/master
Commit: c94301d59ce0a9a8863d3bd71919c1acfebce533
Parents: c87b23e
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Feb 23 16:39:14 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 23 17:10:22 2017 -0500

----------------------------------------------------------------------
 proton-c/bindings/go/genwrap.go                 | 77 ++++++++++++++++----
 .../go/src/qpid.apache.org/amqp/version.go      |  8 +-
 .../src/qpid.apache.org/proton/wrappers_gen.go  | 39 +---------
 proton-c/bindings/go/test-versions.sh           | 50 +++++++++++++
 4 files changed, 125 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c94301d5/proton-c/bindings/go/genwrap.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/genwrap.go b/proton-c/bindings/go/genwrap.go
index 6885b74..0bf13fa 100644
--- a/proton-c/bindings/go/genwrap.go
+++ b/proton-c/bindings/go/genwrap.go
@@ -22,6 +22,12 @@ under the License.
 // Not run automatically, generated sources are checked in. To update the
 // generated sources run `go run genwrap.go` in this directory.
 //
+// WARNING: generating code from the wrong proton header file versions
+// will break compatibility guarantees. This program will attempt to detect
+// such errors. If you are deliberately changing the compatibility requirements
+// update the variable minVersion below.
+//
+
 package main
 
 import (
@@ -37,12 +43,61 @@ import (
 	"text/template"
 )
 
-var includeProton = "../../include/proton"
-var outpath = "src/qpid.apache.org/proton/wrappers_gen.go"
+var minVersion = "0.10" // The minimum version of proton-c that the Go binding can use
+var include = flag.String("include", "../../include", "Directory containing proton/*.h include files")
+
+var versionH = regexp.MustCompile("(?s:PN_VERSION_MAJOR ([0-9]+).*PN_VERSION_MINOR ([0-9]+))")
+var versionTxt = regexp.MustCompile("^[0-9]+\\.[0-9]+")
 
 func main() {
 	flag.Parse()
-	out, err := os.Create(outpath)
+	genVersion()
+	genWrappers()
+}
+
+func getVersion() string {
+	_, err := ioutil.ReadFile(path.Join(*include, "proton/version.h.in"))
+	if err == nil {
+		// We are using the headers in git sources, get the version.txt
+		vt, err := ioutil.ReadFile(path.Join(*include, "../../version.txt"))
+		panicIf(err)
+		return versionTxt.FindString(string(vt))
+	}
+	vh, err := ioutil.ReadFile(path.Join(*include, "proton/version.h"))
+	if err == nil {
+		// We are using installed headers
+		return strings.Join(versionH.FindStringSubmatch(string(vh))[1:], ".")
+	}
+	panic(err)
+}
+
+func genVersion() {
+	version := getVersion()
+	if minVersion != version {
+		panic(fmt.Errorf("Generating from wrong version %v, expected %v", version, minVersion))
+	}
+	out, err := os.Create("src/qpid.apache.org/amqp/version.go")
+	panicIf(err)
+	defer out.Close()
+	splitVersion := strings.Split(minVersion, ".")
+	fmt.Fprintf(out, copyright+`
+
+package amqp
+
+// Version check for proton library.
+// Done here because this is the lowest-level dependency for all the proton Go packages.
+
+// #include <proton/version.h>
+// #if PN_VERSION_MAJOR == %s && PN_VERSION_MINOR < %s
+// #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater
+// #endif
+import "C"
+`, splitVersion[0], splitVersion[1])
+}
+
+func genWrappers() {
+	outPath := "src/qpid.apache.org/proton/wrappers_gen.go"
+	out, err := os.Create(outPath)
 	panicIf(err)
 	defer out.Close()
 
@@ -56,11 +111,13 @@ import (
   "unsafe"
 )
 
-// #include <proton/types.h>
-// #include <proton/error.h>
 // #include <proton/condition.h>
+// #include <proton/error.h>
 // #include <proton/event.h>
+// #include <proton/types.h>
 // #include <stdlib.h>
+import "C"
+
 `)
 	for _, api := range apis {
 		fmt.Fprintf(out, "// #include <proton/%s.h>\n", api)
@@ -79,13 +136,7 @@ import (
 		apiWrapFns(api, header, out)
 	}
 	out.Close()
-
-	// Run gofmt.
-	cmd := exec.Command("gofmt", "-w", outpath)
-	cmd.Stdout = os.Stdout
-	cmd.Stderr = os.Stderr
-	err = cmd.Run()
-	if err != nil {
+	if err := exec.Command("gofmt", "-w", outPath).Run(); err != nil {
 		fmt.Fprintf(os.Stderr, "gofmt: %s", err)
 		os.Exit(1)
 	}
@@ -161,7 +212,7 @@ func panicIf(err error) {
 }
 
 func readHeader(name string) string {
-	s, err := ioutil.ReadFile(path.Join(includeProton, name+".h"))
+	s, err := ioutil.ReadFile(path.Join(*include, "proton", name+".h"))
 	panicIf(err)
 	return string(s)
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c94301d5/proton-c/bindings/go/src/qpid.apache.org/amqp/version.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/version.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/version.go
index cefa904..bf33d2b 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/version.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/version.go
@@ -17,13 +17,19 @@ specific language governing permissions and limitations
 under the License.
 */
 
+//
+// NOTE: DO NOT EDIT. This file was generated by genwrap.go from the proton header files.
+// Update the generator and re-run if you need to modify this code.
+//
+
+
 package amqp
 
 // Version check for proton library.
 // Done here because this is the lowest-level dependency for all the proton Go packages.
 
 // #include <proton/version.h>
-// #if PN_VERSION_MINOR < 10
+// #if PN_VERSION_MAJOR == 0 && PN_VERSION_MINOR < 10
 // #error packages qpid.apache.org/... require Proton-C library version 0.10 or greater
 // #endif
 import "C"

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c94301d5/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
index a6c6635..0db04c8 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/wrappers_gen.go
@@ -29,11 +29,13 @@ import (
 	"unsafe"
 )
 
-// #include <proton/types.h>
-// #include <proton/error.h>
 // #include <proton/condition.h>
+// #include <proton/error.h>
 // #include <proton/event.h>
+// #include <proton/types.h>
 // #include <stdlib.h>
+import "C"
+
 // #include <proton/session.h>
 // #include <proton/link.h>
 // #include <proton/delivery.h>
@@ -78,13 +80,6 @@ const (
 	ETransportHeadClosed    EventType = C.PN_TRANSPORT_HEAD_CLOSED
 	ETransportTailClosed    EventType = C.PN_TRANSPORT_TAIL_CLOSED
 	ETransportClosed        EventType = C.PN_TRANSPORT_CLOSED
-	EConnectionWake         EventType = C.PN_CONNECTION_WAKE
-	EListenerAccept         EventType = C.PN_LISTENER_ACCEPT
-	EListenerClose          EventType = C.PN_LISTENER_CLOSE
-	EProactorInterrupt      EventType = C.PN_PROACTOR_INTERRUPT
-	EProactorTimeout        EventType = C.PN_PROACTOR_TIMEOUT
-	EProactorInactive       EventType = C.PN_PROACTOR_INACTIVE
-	EListenerOpen           EventType = C.PN_LISTENER_OPEN
 )
 
 func (e EventType) String() string {
@@ -150,20 +145,6 @@ func (e EventType) String() string {
 		return "TransportTailClosed"
 	case C.PN_TRANSPORT_CLOSED:
 		return "TransportClosed"
-	case C.PN_CONNECTION_WAKE:
-		return "ConnectionWake"
-	case C.PN_LISTENER_ACCEPT:
-		return "ListenerAccept"
-	case C.PN_LISTENER_CLOSE:
-		return "ListenerClose"
-	case C.PN_PROACTOR_INTERRUPT:
-		return "ProactorInterrupt"
-	case C.PN_PROACTOR_TIMEOUT:
-		return "ProactorTimeout"
-	case C.PN_PROACTOR_INACTIVE:
-		return "ProactorInactive"
-	case C.PN_LISTENER_OPEN:
-		return "ListenerOpen"
 	}
 	return "Unknown"
 }
@@ -373,15 +354,6 @@ func (l Link) SetDrain(drain bool) {
 func (l Link) Draining() bool {
 	return bool(C.pn_link_draining(l.pn))
 }
-func (l Link) MaxMessageSize() uint64 {
-	return uint64(C.pn_link_max_message_size(l.pn))
-}
-func (l Link) SetMaxMessageSize(size uint64) {
-	C.pn_link_set_max_message_size(l.pn, C.uint64_t(size))
-}
-func (l Link) RemoteMaxMessageSize() uint64 {
-	return uint64(C.pn_link_remote_max_message_size(l.pn))
-}
 
 // Wrappers for declarations in delivery.h
 
@@ -529,9 +501,6 @@ func (c Condition) RedirectHost() string {
 func (c Condition) RedirectPort() int {
 	return int(C.pn_condition_redirect_port(c.pn))
 }
-func (c Condition) Copy(src Condition) int {
-	return int(C.pn_condition_copy(c.pn, src.pn))
-}
 
 // Wrappers for declarations in terminus.h
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c94301d5/proton-c/bindings/go/test-versions.sh
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/test-versions.sh b/proton-c/bindings/go/test-versions.sh
new file mode 100755
index 0000000..0022ce3
--- /dev/null
+++ b/proton-c/bindings/go/test-versions.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Takes a list of install prefixes and tests the go source under the current directory
+# against the proton install in each prefix.
+#
+# NOTE: This script will fail if it finds proton headers or libraries installed in standard
+# places or on the existing paths, to avoid possible confusion.
+#
+
+for VAR in LD_LIBRARY_PATH LIBRARY_PATH C_INCLUDE_PATH; do
+    declare OLD_${VAR}=${!VAR};
+done
+
+prefix() {
+    prefix=$1
+    export LD_LIBRARY_PATH="$prefix/lib64:$prefix/lib:$OLD_LD_LIBRARY_PATH"
+    export LIBRARY_PATH="$prefix/lib64:$prefix/lib:$OLD_LIBRARY_PATH"
+    export C_INCLUDE_PATH="$prefix/include:$OLD_C_INCLUDE_PATH"
+}
+
+TEMP=$(mktemp -d)
+trap "rm -rf $TEMP"  EXIT
+set -o pipefail
+
+cat > $TEMP/test.c  <<EOF
+#include <proton/connection.h>
+int main(int c, char **a) { return 0; }
+EOF
+cc $TEMP/test.c 2> /dev/null && {
+    echo "cc found proton in include path"; cc -E | grep proton/connection.h | head -n1; exit 1; } 1>&2
+
+cat > $TEMP/test.c  <<EOF
+int main(int c, char **a) { return 0; }
+EOF
+cc -lqpid-proton $TEMPC 2>/dev/null && { echo "cc found proton in library path" 1>&2 ; exit 1; }
+
+for P in "$@"; do
+    (
+        case $P in
+            /*) ;;
+            *) P=$PWD/$P;;
+        esac
+        test -d $P || { echo "no such directory: $P"; continue; }
+        echo ==== $P
+        prefix $P
+        export GOPATH=$PWD
+        git clean -dfx
+        go test qpid.apache.org/...
+    )
+done


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[3/6] qpid-proton git commit: Revert "PROTON-1351: link go binding with qpid-proton-core library"

Posted by ac...@apache.org.
Revert "PROTON-1351: link go binding with qpid-proton-core library"

This reverts commit a1d84b0e212ebd1b7a8b2f9a52dc83337995dca3.

Linking with the -core library makes the Go binding needlessly incompatible
with older versions of proton.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/45f7b05e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/45f7b05e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/45f7b05e

Branch: refs/heads/master
Commit: 45f7b05eac7923d1f27a671c0574611c34361537
Parents: 5d1c247
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Feb 23 15:20:37 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 23 15:26:09 2017 -0500

----------------------------------------------------------------------
 proton-c/bindings/go/src/qpid.apache.org/amqp/doc.go     | 2 +-
 proton-c/bindings/go/src/qpid.apache.org/electron/doc.go | 2 +-
 proton-c/bindings/go/src/qpid.apache.org/proton/doc.go   | 2 +-
 proton-c/bindings/go/src/qpid.apache.org/proton/error.go | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/45f7b05e/proton-c/bindings/go/src/qpid.apache.org/amqp/doc.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/doc.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/doc.go
index c04c2b0..701af55 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/doc.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/doc.go
@@ -32,7 +32,7 @@ AMQP 1.0 is an open standard for inter-operable message exchange, see <http://ww
 */
 package amqp
 
-// #cgo LDFLAGS: -lqpid-proton-core
+// #cgo LDFLAGS: -lqpid-proton
 import "C"
 
 // This file is just for the package comment.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/45f7b05e/proton-c/bindings/go/src/qpid.apache.org/electron/doc.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/doc.go b/proton-c/bindings/go/src/qpid.apache.org/electron/doc.go
index 39137c0..f4baa31 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/doc.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/doc.go
@@ -50,7 +50,7 @@ More realistic examples: https://github.com/apache/qpid-proton/blob/master/examp
 */
 package electron
 
-//#cgo LDFLAGS: -lqpid-proton-core
+//#cgo LDFLAGS: -lqpid-proton
 import "C"
 
 // Just for package comment

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/45f7b05e/proton-c/bindings/go/src/qpid.apache.org/proton/doc.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/doc.go b/proton-c/bindings/go/src/qpid.apache.org/proton/doc.go
index 39716e2..1049e71 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/doc.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/doc.go
@@ -60,7 +60,7 @@ applications.
 */
 package proton
 
-// #cgo LDFLAGS: -lqpid-proton-core
+// #cgo LDFLAGS: -lqpid-proton
 import "C"
 
 // This file is just for the package comment.

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/45f7b05e/proton-c/bindings/go/src/qpid.apache.org/proton/error.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/error.go b/proton-c/bindings/go/src/qpid.apache.org/proton/error.go
index 5232fec..80d9680 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/error.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/error.go
@@ -20,7 +20,7 @@ under the License.
 // Internal implementation details - ignore.
 package proton
 
-// #cgo LDFLAGS: -lqpid-proton-core
+// #cgo LDFLAGS: -lqpid-proton
 // #include <proton/error.h>
 // #include <proton/codec.h>
 import "C"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[2/6] qpid-proton git commit: PROTON-1415: event.h remove duplicate enums

Posted by ac...@apache.org.
PROTON-1415: event.h remove duplicate enums

event.h defines some "alias" enums, move these out of the enum declearation and
make them static const aliases instead. No effect on existing code but simplifies
code generation for Go binding.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/540e74e2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/540e74e2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/540e74e2

Branch: refs/heads/master
Commit: 540e74e28266b1f914d1b3498168060264552d62
Parents: 45f7b05
Author: Alan Conway <ac...@redhat.com>
Authored: Thu Feb 23 08:41:06 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Thu Feb 23 15:26:09 2017 -0500

----------------------------------------------------------------------
 proton-c/include/proton/event.h | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/540e74e2/proton-c/include/proton/event.h
----------------------------------------------------------------------
diff --git a/proton-c/include/proton/event.h b/proton-c/include/proton/event.h
index b4dbfeb..c1c4fed 100644
--- a/proton-c/include/proton/event.h
+++ b/proton-c/include/proton/event.h
@@ -282,12 +282,6 @@ typedef enum {
   PN_TRANSPORT_HEAD_CLOSED,
 
   /**
-   * The write side of the transport is closed, it will no longer produce bytes
-   * to write to external IO. Synonynm for PN_TRANSPORT_HEAD_CLOSED
-   */
-  PN_TRANSPORT_WRITE_CLOSED = PN_TRANSPORT_HEAD_CLOSED,
-
-  /**
    * Indicates that the tail of the transport has been closed. This
    * means the transport will never be able to process more bytes from
    * the network. Events of this type point to the relevant transport.
@@ -295,12 +289,6 @@ typedef enum {
   PN_TRANSPORT_TAIL_CLOSED,
 
   /**
-   * The read side of the transport is closed, it will no longer read bytes
-   * from external IO. Synonynm for PN_TRANSPORT_TAIL_CLOSED
-   */
-  PN_TRANSPORT_READ_CLOSED = PN_TRANSPORT_TAIL_CLOSED,
-
-  /**
    * Indicates that the both the head and tail of the transport are
    * closed. Events of this type point to the relevant transport.
    */
@@ -361,6 +349,19 @@ typedef enum {
 
 } pn_event_type_t;
 
+
+/**
+ * The write side of the transport is closed, it will no longer produce bytes
+ * to write to external IO. Synonynm for PN_TRANSPORT_HEAD_CLOSED
+ */
+static const pn_event_type_t PN_TRANSPORT_WRITE_CLOSED = PN_TRANSPORT_HEAD_CLOSED;
+
+/**
+ * The read side of the transport is closed, it will no longer read bytes
+ * from external IO. Synonynm for PN_TRANSPORT_TAIL_CLOSED
+ */
+static const pn_event_type_t PN_TRANSPORT_READ_CLOSED = PN_TRANSPORT_TAIL_CLOSED;
+
 /**
  * Get a human readable name for an event type.
  *


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org