Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a8087dc1
Commit
a8087dc1
authored
Oct 19, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neighbor/Glue: mention failed plugin name in error message
parent
070c03db
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
NEWS
NEWS
+2
-0
Glue.cxx
src/neighbor/Glue.cxx
+11
-5
Glue.hxx
src/neighbor/Glue.hxx
+6
-3
No files found.
NEWS
View file @
a8087dc1
ver 0.23.2 (not yet released)
* neighbor
- mention failed plugin name in error message
ver 0.23.1 (2021/10/19)
* protocol
...
...
src/neighbor/Glue.cxx
View file @
a8087dc1
...
...
@@ -33,12 +33,9 @@ NeighborGlue::~NeighborGlue() noexcept = default;
static
std
::
unique_ptr
<
NeighborExplorer
>
CreateNeighborExplorer
(
EventLoop
&
loop
,
NeighborListener
&
listener
,
const
char
*
plugin_name
,
const
ConfigBlock
&
block
)
{
const
char
*
plugin_name
=
block
.
GetBlockValue
(
"plugin"
);
if
(
plugin_name
==
nullptr
)
throw
std
::
runtime_error
(
"Missing
\"
plugin
\"
configuration"
);
const
NeighborPlugin
*
plugin
=
GetNeighborPluginByName
(
plugin_name
);
if
(
plugin
==
nullptr
)
throw
FormatRuntimeError
(
"No such neighbor plugin: %s"
,
...
...
@@ -55,8 +52,14 @@ NeighborGlue::Init(const ConfigData &config,
block
.
SetUsed
();
try
{
explorers
.
emplace_front
(
CreateNeighborExplorer
(
loop
,
const
char
*
plugin_name
=
block
.
GetBlockValue
(
"plugin"
);
if
(
plugin_name
==
nullptr
)
throw
std
::
runtime_error
(
"Missing
\"
plugin
\"
configuration"
);
explorers
.
emplace_front
(
plugin_name
,
CreateNeighborExplorer
(
loop
,
listener
,
plugin_name
,
block
));
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Line %i: "
,
...
...
@@ -76,6 +79,9 @@ NeighborGlue::Open()
/* roll back */
for
(
auto
k
=
explorers
.
begin
();
k
!=
i
;
++
k
)
k
->
explorer
->
Close
();
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to open neighblor plugin '%s'"
,
i
->
name
.
c_str
()));
throw
;
}
}
...
...
src/neighbor/Glue.hxx
View file @
a8087dc1
...
...
@@ -24,6 +24,7 @@
#include <forward_list>
#include <memory>
#include <string>
struct
ConfigData
;
class
EventLoop
;
...
...
@@ -36,11 +37,13 @@ struct NeighborInfo;
*/
class
NeighborGlue
{
struct
Explorer
{
const
std
::
string
name
;
std
::
unique_ptr
<
NeighborExplorer
>
explorer
;
template
<
typename
E
>
Explorer
(
E
&&
_explorer
)
noexcept
:
explorer
(
std
::
forward
<
E
>
(
_explorer
))
{}
template
<
typename
N
,
typename
E
>
Explorer
(
N
&&
_name
,
E
&&
_explorer
)
noexcept
:
name
(
std
::
forward
<
N
>
(
_name
)),
explorer
(
std
::
forward
<
E
>
(
_explorer
))
{}
Explorer
(
const
Explorer
&
)
=
delete
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment