Skip to content

Commit

Permalink
[apps] Added linger URI socket option
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored and rndi committed Jun 10, 2019
1 parent 7a85138 commit 832b52d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/socketoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ SocketOption::Mode SrtConfigurePre(SRTSOCKET socket, string host, map<string, st
fails.push_back("mode");
}

if (options.count("linger"))
{
linger lin;
lin.l_linger = stoi(options["linger"]);
lin.l_onoff = lin.l_linger > 0 ? 1 : 0;
srt_setsockopt(socket, SocketOption::PRE, SRTO_LINGER, &lin, sizeof(linger));
}


bool all_clear = true;
for (auto o: srt_options)
{
Expand Down
2 changes: 2 additions & 0 deletions apps/socketoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ const SocketOption srt_options [] {
{ "fc", 0, SRTO_FC, SocketOption::PRE, SocketOption::INT, nullptr},
{ "sndbuf", 0, SRTO_SNDBUF, SocketOption::PRE, SocketOption::INT, nullptr},
{ "rcvbuf", 0, SRTO_RCVBUF, SocketOption::PRE, SocketOption::INT, nullptr},
// linger option is handled outside of the common loop, therefore commented out.
//{ "linger", 0, SRTO_LINGER, SocketOption::PRE, SocketOption::INT, nullptr},
{ "ipttl", 0, SRTO_IPTTL, SocketOption::PRE, SocketOption::INT, nullptr},
{ "iptos", 0, SRTO_IPTOS, SocketOption::PRE, SocketOption::INT, nullptr},
{ "inputbw", 0, SRTO_INPUTBW, SocketOption::POST, SocketOption::INT64, nullptr},
Expand Down

0 comments on commit 832b52d

Please sign in to comment.