MCPcopy Create free account
hub / github.com/Haivision/srt / OpenGroupClient

Method OpenGroupClient

testing/testmedia.cpp:991–1272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

989}
990
991void SrtCommon::OpenGroupClient()
992{
993 SRT_GROUP_TYPE type = ResolveGroupType(m_group_type);
994 if (type == SRT_GTYPE_UNDEFINED)
995 {
996 Error("With //group, type='" + m_group_type + "' undefined");
997 }
998
999 m_sock = srt_create_group(type);
1000 if (m_sock == -1)
1001 Error("srt_create_group");
1002
1003 srt_connect_callback(m_sock, &TransmitGroupSocketConnect, this);
1004
1005 int stat = -1;
1006 if (m_group_config != "")
1007 {
1008 Verb() << "Ignoring setting group config: '" << m_group_config;
1009 }
1010
1011 stat = ConfigurePre(m_sock);
1012
1013 if ( stat == SRT_ERROR )
1014 Error("ConfigurePre");
1015
1016 if (!m_blocking_mode)
1017 {
1018 // Note: here the GROUP is added to the poller.
1019 srt_conn_epoll = AddPoller(m_sock, SRT_EPOLL_CONNECT | SRT_EPOLL_ERR);
1020 }
1021
1022 // Don't check this. Should this fail, the above would already.
1023
1024 // XXX Now do it regardless whether it's blocking or non-blocking
1025 // mode - reading from group is currently manually from every socket.
1026 srt_epoll = srt_epoll_create();
1027
1028 // ConnectClient can't be used here, the code must
1029 // be more-less repeated. In this case the situation
1030 // that not all connections can be established is tolerated,
1031 // the only case of error is when none of the connections
1032 // can be established.
1033
1034 bool any_node = false;
1035
1036 Verb() << "REDUNDANT connections with " << m_group_nodes.size() << " nodes:";
1037
1038 if (m_group_data.empty())
1039 m_group_data.resize(1);
1040
1041 vector<SRT_SOCKGROUPCONFIG> targets;
1042 int namelen = sizeof (sockaddr_any);
1043
1044 Verb() << "Connecting to nodes:";
1045 int i = 1;
1046 for (Connection& c: m_group_nodes)
1047 {
1048 auto sa = CreateAddr(c.host, c.port);

Callers

nothing calls this directly

Calls 15

ResolveGroupTypeFunction · 0.85
srt_create_groupFunction · 0.85
srt_connect_callbackFunction · 0.85
VerbFunction · 0.85
srt_epoll_createFunction · 0.85
SprintFunction · 0.85
srt_prepare_endpointFunction · 0.85
srt_connect_groupFunction · 0.85
srt_strerrorFunction · 0.85
srt_rejectreason_strFunction · 0.85
srt_group_dataFunction · 0.85
srt_epoll_waitFunction · 0.85

Tested by

no test coverage detected