FIXTradingCommunity / fixp-specification

FIXP - FIX performance session layer specification
Other
49 stars 17 forks source link

[04PointToPointSessionProtocol.md] Transport termination on session Terminate #56

Closed ujos closed 6 years ago

ujos commented 7 years ago

From one side peer may terminate transport:

A session may terminate its transport if there are no more messages to send but it intends to restart at a later time.

From another side peer must close transport:

On a connection-oriented transport such as TCP, when the initiator receives the Terminate response, it must disconnect the transport from its end. When the acceptor receives the TCP peer reset signal, it completes closing of the transport.

So, must peer close transport?

Also in case of multiplexing, peer cannot terminate transport if there are more than one Sessions bound to Transport.

donmendelson commented 7 years ago

Good point. Also, there is nothing in session messages that states whether a session is on a multiplexed transport. So there is no way to verify protocol conformance strictly from a message log. Not only about terminate, but also whether a Sequence or Context message is used for sequence numbers. I'm thinking that Negotiate should have an indicator that tells whether the session intends to follow non-multiplexed or multiplexed rules. (The XMIT spec that FIXP is based on does not have such an indicator.)

adkapur commented 6 years ago

For multiplexing only the session which established the actual physical transport would be able to close it and this does not apply to the other logical sessions multiplexed on that transport. We were relying on the UUID to know which connection is the physical one and which connection is a logical multiplexed one

donmendelson commented 6 years ago

@adkapur , I would say it differently. Each session (identified by a UUID) equally "owns" a multiplexed transport. Not normative, but the transport's lifetime can be implemented as a reference-counted object. When each session terminates, it decrements the reference counter. When the counter is reduced to zero, the transport object is destroyed. Reference counting is a very common programming construct, e.g. C++ shared pointers.

ujos commented 6 years ago

@adkapur, Server side session, for example, does not establish transport. Transport usually is established by some lower level component, which manages incoming connections. After receiving first message (Negotiate or Establish), this Manager matches connection with Session.

Reference counting approach is more natural, imho.