From 073da8a75c4029fa57f928dbaf3daa2a9289b077 Mon Sep 17 00:00:00 2001 From: paulc Date: Mon, 15 Feb 2010 20:57:37 +0000 Subject: [PATCH] The default stream mode is adapted to the type of transport. Constified some methods of the Transport class. git-svn-id: http://yate.null.ro/svn/yate/trunk@3081 acf43c95-373e-0410-b603-e72c3f656dc1 --- conf.d/sigtransport.conf.sample | 4 ++-- modules/server/sigtransport.cpp | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/conf.d/sigtransport.conf.sample b/conf.d/sigtransport.conf.sample index 67b17a2a..367c7fc3 100644 --- a/conf.d/sigtransport.conf.sample +++ b/conf.d/sigtransport.conf.sample @@ -10,8 +10,8 @@ ; stream: bool: Socket connection type. ; Designed for SCTP sockets to create a stream socket or a sequenced packet socket ; NOTE: for M2PA if stream is false the M2PA autostart should be on true on both ends, -; if stream is false the M2PA autostart should be true only at one end -;stream=true +; if stream is true the M2PA autostart must be true only at one end +;stream=true for TCP or UNIX sockets, false for other types ; local: string: Primary local address ; Format is ipv4:port like: 1.1.1.1:3566 diff --git a/modules/server/sigtransport.cpp b/modules/server/sigtransport.cpp index 4b0d9c25..c12bf015 100644 --- a/modules/server/sigtransport.cpp +++ b/modules/server/sigtransport.cpp @@ -142,18 +142,20 @@ public: virtual bool initialize(const NamedList* config); Transport(const NamedList& params); ~Transport(); - inline unsigned char getVersion(unsigned char* buf) + inline unsigned char getVersion(unsigned char* buf) const { return buf[0]; } - inline unsigned char getType(unsigned char* buf) + inline unsigned char getType(unsigned char* buf) const { return buf[3]; } - inline unsigned char getClass(unsigned char* buf) + inline unsigned char getClass(unsigned char* buf) const { return buf[2]; } - inline int transType() + inline int transType() const { return m_type; } - inline bool listen() + inline bool listen() const { return m_listener != 0; } + inline bool streamDefault() const + { return m_type == Tcp || m_type == Unix; } void setStatus(int status); - inline int status() + inline int status() const { return m_state; } inline void resetListener() { m_listener = 0; } @@ -290,7 +292,7 @@ bool ListenerThread::init(const NamedList& param) { m_socket = new Socket(); bool multi = param.getParam("local1") != 0; - m_stream = param.getBoolValue("stream",true); + m_stream = param.getBoolValue("stream",m_transport->streamDefault()); if (multi && m_transport->transType() != Transport::Sctp) { Debug("ListenerThread",DebugWarn,"Socket %s does not suport multihomed", lookup(m_transport->transType(),s_transType)); @@ -534,7 +536,7 @@ bool Transport::initialize(const NamedList* params) return false; } m_type = lookup(config->getValue("type","sctp"),s_transType); - m_streamer = config->getBoolValue("stream",true); + m_streamer = config->getBoolValue("stream",streamDefault()); m_endpoint = config->getBoolValue("endpoint",false); if (!m_endpoint && m_streamer) { m_listener = new ListenerThread(this);