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
1a09003a
Commit
1a09003a
authored
Jan 16, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: move the UPnPDeviceDirectory instance to class UpnpDatabase
Delete the object when closing the database.
parent
a8277148
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
19 deletions
+8
-19
UpnpDatabasePlugin.cxx
src/db/UpnpDatabasePlugin.cxx
+6
-4
Discovery.cxx
src/db/upnp/Discovery.cxx
+0
-11
Discovery.hxx
src/db/upnp/Discovery.hxx
+2
-4
No files found.
src/db/UpnpDatabasePlugin.cxx
View file @
1a09003a
...
...
@@ -163,9 +163,10 @@ UpnpDatabase::Open(Error &error)
if
(
!
m_lib
)
return
false
;
m_superdir
=
UPnPDeviceDirectory
::
getTheDir
();
if
(
!
m_superdir
||
!
m_superdir
->
ok
())
{
error
.
Set
(
upnp_domain
,
"Discovery services startup failed"
);
m_superdir
=
new
UPnPDeviceDirectory
();
if
(
!
m_superdir
->
ok
())
{
error
.
Set
(
m_superdir
->
GetError
());
delete
m_superdir
;
return
false
;
}
...
...
@@ -180,7 +181,8 @@ void
UpnpDatabase
::
Close
()
{
delete
m_root
;
// TBD decide what we do with the lib and superdir objects
delete
m_superdir
;
// TBD decide what we do with the lib object
}
void
...
...
src/db/upnp/Discovery.cxx
View file @
1a09003a
...
...
@@ -275,17 +275,6 @@ UPnPDeviceDirectory::search()
return
true
;
}
UPnPDeviceDirectory
*
UPnPDeviceDirectory
::
getTheDir
()
{
// TODO: elimate static variable
static
UPnPDeviceDirectory
*
theDevDir
;
if
(
theDevDir
==
nullptr
)
theDevDir
=
new
UPnPDeviceDirectory
();
if
(
theDevDir
&&
!
theDevDir
->
ok
())
return
0
;
return
theDevDir
;
}
bool
UPnPDeviceDirectory
::
getDirServices
(
std
::
vector
<
ContentDirectoryService
>
&
out
)
{
...
...
src/db/upnp/Discovery.hxx
View file @
1a09003a
...
...
@@ -46,14 +46,12 @@ class UPnPDeviceDirectory {
time_t
m_lastSearch
;
UPnPDeviceDirectory
();
public
:
UPnPDeviceDirectory
();
UPnPDeviceDirectory
(
const
UPnPDeviceDirectory
&
)
=
delete
;
UPnPDeviceDirectory
&
operator
=
(
const
UPnPDeviceDirectory
&
)
=
delete
;
/** This class is a singleton. Get the instance here */
static
UPnPDeviceDirectory
*
getTheDir
();
/** Retrieve the directory services currently seen on the network */
bool
getDirServices
(
std
::
vector
<
ContentDirectoryService
>
&
);
...
...
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