mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-26 10:10:24 +01:00
handle SESSION ADD without FROM_PORT
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / trixie (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
This commit is contained in:
parent
91027168f9
commit
d496b15249
1 changed files with 13 additions and 6 deletions
|
@ -893,12 +893,18 @@ namespace client
|
||||||
SendSessionI2PError("Unsupported STYLE");
|
SendSessionI2PError("Unsupported STYLE");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto fromPort = std::stoi(std::string (params[SAM_PARAM_FROM_PORT]));
|
uint16_t fromPort = 0;
|
||||||
if (fromPort == -1)
|
auto it = params.find (SAM_PARAM_FROM_PORT);
|
||||||
|
if (it != params.end ())
|
||||||
|
{
|
||||||
|
auto p = it->second;
|
||||||
|
auto res = std::from_chars(p.data(), p.data() + p.size(), fromPort);
|
||||||
|
if (res.ec != std::errc())
|
||||||
{
|
{
|
||||||
SendSessionI2PError("Invalid from port");
|
SendSessionI2PError("Invalid from port");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
auto subsession = std::make_shared<SAMSubSession>(masterSession, id, type, fromPort);
|
auto subsession = std::make_shared<SAMSubSession>(masterSession, id, type, fromPort);
|
||||||
if (m_Owner.AddSession (subsession))
|
if (m_Owner.AddSession (subsession))
|
||||||
{
|
{
|
||||||
|
@ -1365,8 +1371,9 @@ namespace client
|
||||||
SAMSubSession::SAMSubSession (std::shared_ptr<SAMMasterSession> master, std::string_view name, SAMSessionType type, uint16_t port):
|
SAMSubSession::SAMSubSession (std::shared_ptr<SAMMasterSession> master, std::string_view name, SAMSessionType type, uint16_t port):
|
||||||
SAMSession (master->m_Bridge, name, type), masterSession (master), inPort (port)
|
SAMSession (master->m_Bridge, name, type), masterSession (master), inPort (port)
|
||||||
{
|
{
|
||||||
if (Type == SAMSessionType::eSAMSessionTypeStream)
|
if (Type == SAMSessionType::eSAMSessionTypeStream && port)
|
||||||
{
|
{
|
||||||
|
// additional streaming destination, use default if port is 0
|
||||||
auto d = masterSession->GetLocalDestination ()->CreateStreamingDestination (inPort);
|
auto d = masterSession->GetLocalDestination ()->CreateStreamingDestination (inPort);
|
||||||
if (d) d->Start ();
|
if (d) d->Start ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue