Author: rhs
Date: Thu Jun 19 17:23:10 2014
New Revision: 1603959
URL: http://svn.apache.org/r1603959
Log:
added INIT events for endpoints
Modified:
qpid/proton/trunk/proton-c/bindings/python/proton.py
qpid/proton/trunk/proton-c/include/proton/event.h
qpid/proton/trunk/proton-c/src/engine/engine.c
qpid/proton/trunk/proton-c/src/engine/event.c
qpid/proton/trunk/proton-c/src/messenger/messenger.c
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ConnectionImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LinkImpl.java
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SessionImpl.java
qpid/proton/trunk/proton-j/src/main/resources/cengine.py
qpid/proton/trunk/tests/python/proton_tests/engine.py
Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/trunk/proton-c/bindings/python/proton.py Thu Jun 19 17:23:10
2014
@@ -3307,13 +3307,19 @@ class Event:
CATEGORY_PROTOCOL = PN_EVENT_CATEGORY_PROTOCOL
+ CONNECTION_INIT = PN_CONNECTION_INIT
CONNECTION_LOCAL_STATE = PN_CONNECTION_LOCAL_STATE
CONNECTION_REMOTE_STATE = PN_CONNECTION_REMOTE_STATE
+ CONNECTION_FINAL = PN_CONNECTION_FINAL
+ SESSION_INIT = PN_SESSION_INIT
SESSION_LOCAL_STATE = PN_SESSION_LOCAL_STATE
SESSION_REMOTE_STATE = PN_SESSION_REMOTE_STATE
+ SESSION_FINAL = PN_SESSION_FINAL
+ LINK_INIT = PN_LINK_INIT
LINK_LOCAL_STATE = PN_LINK_LOCAL_STATE
LINK_REMOTE_STATE = PN_LINK_REMOTE_STATE
LINK_FLOW = PN_LINK_FLOW
+ LINK_FINAL = PN_LINK_FINAL
DELIVERY = PN_DELIVERY
TRANSPORT = PN_TRANSPORT
Modified: qpid/proton/trunk/proton-c/include/proton/event.h
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/event.h?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/event.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/event.h Thu Jun 19 17:23:10 2014
@@ -153,7 +153,25 @@ typedef enum {
* completed. This is the final event that will ever be issued for a
* link.
*/
- PN_LINK_FINAL = PN_EVENT_CATEGORY_PROTOCOL+12
+ PN_LINK_FINAL = PN_EVENT_CATEGORY_PROTOCOL+12,
+
+ /**
+ * The connection has been created. This is the first event that
+ * will ever be issued for a connection.
+ */
+ PN_CONNECTION_INIT = PN_EVENT_CATEGORY_PROTOCOL+13,
+
+ /**
+ * The session has been created. This is the first event that will
+ * ever be issued for a session.
+ */
+ PN_SESSION_INIT = PN_EVENT_CATEGORY_PROTOCOL+14,
+
+ /**
+ * The link has been created. This is the first event that will ever
+ * be issued for a link.
+ */
+ PN_LINK_INIT = PN_EVENT_CATEGORY_PROTOCOL+15
} pn_event_type_t;
Modified: qpid/proton/trunk/proton-c/src/engine/engine.c
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/engine/engine.c?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/engine/engine.c (original)
+++ qpid/proton/trunk/proton-c/src/engine/engine.c Thu Jun 19 17:23:10 2014
@@ -395,9 +395,20 @@ pn_connection_t *pn_connection()
return conn;
}
+static const pn_event_type_t endpoint_init_event_map[] = {
+ PN_CONNECTION_INIT, /* CONNECTION */
+ PN_SESSION_INIT, /* SESSION */
+ PN_LINK_INIT, /* SENDER */
+ PN_LINK_INIT}; /* RECEIVER */
+
void pn_connection_collect(pn_connection_t *connection, pn_collector_t
*collector)
{
connection->collector = collector;
+ pn_endpoint_t *endpoint = connection->endpoint_head;
+ while (endpoint) {
+ pn_collector_put(connection->collector,
endpoint_init_event_map[endpoint->type], endpoint);
+ endpoint = endpoint->endpoint_next;
+ }
}
pn_state_t pn_connection_state(pn_connection_t *connection)
@@ -728,6 +739,7 @@ pn_session_t *pn_session(pn_connection_t
ssn->state.remote_handles = pn_hash(0, 0.75, PN_REFCOUNT);
// end transport state
+ pn_collector_put(conn->collector, PN_SESSION_INIT, ssn);
return ssn;
}
@@ -841,8 +853,9 @@ pn_link_t *pn_link_new(int type, pn_sess
link->state.remote_handle = -1;
link->state.delivery_count = 0;
link->state.link_credit = 0;
- // end transport stat
+ // end transport state
+ pn_collector_put(session->connection->collector, PN_LINK_INIT, link);
return link;
}
Modified: qpid/proton/trunk/proton-c/src/engine/event.c
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/engine/event.c?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/engine/event.c (original)
+++ qpid/proton/trunk/proton-c/src/engine/event.c Thu Jun 19 17:23:10 2014
@@ -206,6 +206,7 @@ pn_connection_t *pn_event_connection(pn_
case PN_CONNECTION_REMOTE_STATE:
case PN_CONNECTION_LOCAL_STATE:
case PN_CONNECTION_FINAL:
+ case PN_CONNECTION_INIT:
return (pn_connection_t *)event->context;
case PN_TRANSPORT:
transport = pn_event_transport(event);
@@ -227,6 +228,7 @@ pn_session_t *pn_event_session(pn_event_
case PN_SESSION_REMOTE_STATE:
case PN_SESSION_LOCAL_STATE:
case PN_SESSION_FINAL:
+ case PN_SESSION_INIT:
return (pn_session_t *)event->context;
default:
link = pn_event_link(event);
@@ -244,6 +246,7 @@ pn_link_t *pn_event_link(pn_event_t *eve
case PN_LINK_LOCAL_STATE:
case PN_LINK_FLOW:
case PN_LINK_FINAL:
+ case PN_LINK_INIT:
return (pn_link_t *)event->context;
default:
dlv = pn_event_delivery(event);
@@ -275,18 +278,24 @@ const char *pn_event_type_name(pn_event_
switch (type) {
case PN_EVENT_NONE:
return "PN_EVENT_NONE";
+ case PN_CONNECTION_INIT:
+ return "PN_CONNECTION_INIT";
case PN_CONNECTION_REMOTE_STATE:
return "PN_CONNECTION_REMOTE_STATE";
case PN_CONNECTION_LOCAL_STATE:
return "PN_CONNECTION_LOCAL_STATE";
case PN_CONNECTION_FINAL:
return "PN_CONNECTION_FINAL";
+ case PN_SESSION_INIT:
+ return "PN_SESSION_INIT";
case PN_SESSION_REMOTE_STATE:
return "PN_SESSION_REMOTE_STATE";
case PN_SESSION_LOCAL_STATE:
return "PN_SESSION_LOCAL_STATE";
case PN_SESSION_FINAL:
return "PN_SESSION_FINAL";
+ case PN_LINK_INIT:
+ return "PN_LINK_INIT";
case PN_LINK_REMOTE_STATE:
return "PN_LINK_REMOTE_STATE";
case PN_LINK_LOCAL_STATE:
Modified: qpid/proton/trunk/proton-c/src/messenger/messenger.c
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/messenger/messenger.c?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/messenger/messenger.c (original)
+++ qpid/proton/trunk/proton-c/src/messenger/messenger.c Thu Jun 19 17:23:10
2014
@@ -1224,6 +1224,15 @@ int pn_messenger_process_events(pn_messe
while ((event = pn_collector_peek(messenger->collector))) {
processed++;
switch (pn_event_type(event)) {
+ case PN_CONNECTION_INIT:
+ //printf("connection created: %p\n", (void *)
pn_event_connection(event));
+ break;
+ case PN_SESSION_INIT:
+ //printf("session created: %p\n", (void *) pn_event_session(event));
+ break;
+ case PN_LINK_INIT:
+ //printf("link created: %p\n", (void *) pn_event_link(event));
+ break;
case PN_CONNECTION_REMOTE_STATE:
case PN_CONNECTION_LOCAL_STATE:
pn_messenger_process_connection(messenger, event);
Modified:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
---
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
(original)
+++
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Event.java
Thu Jun 19 17:23:10 2014
@@ -41,7 +41,13 @@ public interface Event
LINK_LOCAL_STATE(Category.PROTOCOL, 6),
LINK_FLOW(Category.PROTOCOL, 7),
DELIVERY(Category.PROTOCOL, 8),
- TRANSPORT(Category.PROTOCOL, 9);
+ TRANSPORT(Category.PROTOCOL, 9),
+ CONNECTION_FINAL(Category.PROTOCOL, 10),
+ SESSION_FINAL(Category.PROTOCOL, 11),
+ LINK_FINAL(Category.PROTOCOL, 12),
+ CONNECTION_INIT(Category.PROTOCOL, 13),
+ SESSION_INIT(Category.PROTOCOL, 14),
+ LINK_INIT(Category.PROTOCOL, 15);
private int _opcode;
private Category _category;
Modified:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ConnectionImpl.java
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ConnectionImpl.java?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
---
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ConnectionImpl.java
(original)
+++
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/ConnectionImpl.java
Thu Jun 19 17:23:10 2014
@@ -568,6 +568,20 @@ public class ConnectionImpl extends Endp
public void collect(Collector collector)
{
_collector = (CollectorImpl) collector;
+
+ put(Event.Type.CONNECTION_INIT, this);
+
+ LinkNode<SessionImpl> ssn = _sessionHead;
+ while (ssn != null) {
+ put(Event.Type.SESSION_INIT, ssn.getValue());
+ ssn = ssn.getNext();
+ }
+
+ LinkNode<LinkImpl> lnk = _linkHead;
+ while (lnk != null) {
+ put(Event.Type.LINK_INIT, lnk.getValue());
+ lnk = lnk.getNext();
+ }
}
EventImpl put(Event.Type type, Object context)
Modified:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LinkImpl.java
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LinkImpl.java?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
---
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LinkImpl.java
(original)
+++
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/LinkImpl.java
Thu Jun 19 17:23:10 2014
@@ -60,7 +60,9 @@ public abstract class LinkImpl extends E
{
_session = session;
_name = name;
- _node = session.getConnectionImpl().addLinkEndpoint(this);
+ ConnectionImpl conn = session.getConnectionImpl();
+ _node = conn.addLinkEndpoint(this);
+ conn.put(Event.Type.LINK_INIT, this);
}
Modified:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SessionImpl.java
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SessionImpl.java?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
---
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SessionImpl.java
(original)
+++
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SessionImpl.java
Thu Jun 19 17:23:10 2014
@@ -46,6 +46,7 @@ public class SessionImpl extends Endpoin
{
_connection = connection;
_node = _connection.addSessionEndpoint(this);
+ _connection.put(Event.Type.SESSION_INIT, this);
}
public SenderImpl sender(String name)
Modified: qpid/proton/trunk/proton-j/src/main/resources/cengine.py
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cengine.py?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cengine.py (original)
+++ qpid/proton/trunk/proton-j/src/main/resources/cengine.py Thu Jun 19
17:23:10 2014
@@ -940,13 +940,19 @@ from org.apache.qpid.proton.engine impor
PN_EVENT_CATEGORY_PROTOCOL = Event.Category.PROTOCOL
+PN_CONNECTION_INIT = Event.Type.CONNECTION_INIT
PN_CONNECTION_LOCAL_STATE = Event.Type.CONNECTION_LOCAL_STATE
PN_CONNECTION_REMOTE_STATE = Event.Type.CONNECTION_REMOTE_STATE
+PN_CONNECTION_FINAL = Event.Type.CONNECTION_FINAL
+PN_SESSION_INIT = Event.Type.SESSION_INIT
PN_SESSION_LOCAL_STATE = Event.Type.SESSION_LOCAL_STATE
PN_SESSION_REMOTE_STATE = Event.Type.SESSION_REMOTE_STATE
+PN_SESSION_FINAL = Event.Type.SESSION_FINAL
+PN_LINK_INIT = Event.Type.LINK_INIT
PN_LINK_LOCAL_STATE = Event.Type.LINK_LOCAL_STATE
PN_LINK_REMOTE_STATE = Event.Type.LINK_REMOTE_STATE
PN_LINK_FLOW = Event.Type.LINK_FLOW
+PN_LINK_FINAL = Event.Type.LINK_FINAL
PN_DELIVERY = Event.Type.DELIVERY
PN_TRANSPORT = Event.Type.TRANSPORT
Modified: qpid/proton/trunk/tests/python/proton_tests/engine.py
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/engine.py?rev=1603959&r1=1603958&r2=1603959&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/engine.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/engine.py Thu Jun 19 17:23:10
2014
@@ -2097,7 +2097,7 @@ class EventTest(Test):
c1, c2 = self.connection()
coll = Collector()
c1.collect(coll)
- self.expect(coll)
+ self.expect(coll, Event.CONNECTION_INIT)
self.pump()
self.expect(coll)
c2.open()
@@ -2113,7 +2113,8 @@ class EventTest(Test):
self.expect(coll)
self.pump()
- self.expect(coll, Event.SESSION_REMOTE_STATE, Event.LINK_REMOTE_STATE)
+ self.expect(coll, Event.SESSION_INIT, Event.SESSION_REMOTE_STATE,
+ Event.LINK_INIT, Event.LINK_REMOTE_STATE)
c1.open()
ssn2 = c1.session()
@@ -2124,8 +2125,10 @@ class EventTest(Test):
self.expect(coll,
Event.CONNECTION_LOCAL_STATE,
Event.TRANSPORT,
+ Event.SESSION_INIT,
Event.SESSION_LOCAL_STATE,
Event.TRANSPORT,
+ Event.LINK_INIT,
Event.LINK_LOCAL_STATE,
Event.TRANSPORT)
@@ -2136,7 +2139,8 @@ class EventTest(Test):
rcv.open()
rcv.flow(10)
self.pump()
- self.expect(coll, Event.LINK_REMOTE_STATE, Event.LINK_FLOW)
+ self.expect(coll, Event.CONNECTION_INIT, Event.SESSION_INIT,
+ Event.LINK_INIT, Event.LINK_REMOTE_STATE, Event.LINK_FLOW)
rcv.flow(10)
self.pump()
self.expect(coll, Event.LINK_FLOW)
@@ -2149,7 +2153,9 @@ class EventTest(Test):
rcv.open()
rcv.flow(10)
self.pump()
- self.expect(coll, Event.LINK_LOCAL_STATE, Event.TRANSPORT, Event.TRANSPORT)
+ self.expect(coll, Event.CONNECTION_INIT, Event.SESSION_INIT,
+ Event.LINK_INIT, Event.LINK_LOCAL_STATE, Event.TRANSPORT,
+ Event.TRANSPORT)
snd.delivery("delivery")
snd.send("Hello World!")
snd.advance()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]