Skip to content

Commit 0a80bc2

Browse files
ulmus-scottlinuxdude42
authored andcommitted
de-duplicate class MythServer (ODR violation)
The two versions were equivalent, since ServerPool() defaults to nullptr. It is a minimal class, and always has been, so inline it completely. It has been only rarely edited and must include "serverpool.h" for its inheritance, so place it in "serverpool.h".
1 parent 0974595 commit 0a80bc2

File tree

7 files changed

+22
-54
lines changed

7 files changed

+22
-54
lines changed

mythtv/libs/libmythbase/serverpool.h

+18-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
* collectively for any new connections.
2121
*
2222
* This can be subclassed with new 'newTcpConnection()' and 'newConnection()'
23-
* methods to allow signalling for alternate socket types.
23+
* methods to allow signalling for alternate socket types. For a minimal
24+
* example see MythServer.
2425
*/
2526

2627
class PrivUdpSocket;
@@ -127,4 +128,20 @@ class MBASE_PUBLIC ServerPool : public QObject
127128
PrivUdpSocket *m_lastUdpSocket {nullptr};
128129
};
129130

131+
class MBASE_PUBLIC MythServer : public ServerPool
132+
{
133+
Q_OBJECT
134+
public:
135+
explicit MythServer(QObject *parent = nullptr) : ServerPool(parent) {}
136+
137+
signals:
138+
void newConnection(qintptr socket);
139+
140+
protected slots:
141+
void newTcpConnection(qintptr socket) override // ServerPool
142+
{
143+
emit newConnection(socket);
144+
}
145+
};
146+
130147
#endif

mythtv/libs/libmythprotoserver/mythsocketmanager.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ class ProcessRequestRunnable : public QRunnable
4646
MythSocket *m_sock;
4747
};
4848

49-
MythServer::MythServer(QObject *parent) : ServerPool(parent)
50-
{
51-
}
52-
53-
void MythServer::newTcpConnection(qintptr socket)
54-
{
55-
emit newConnection(socket);
56-
}
57-
5849
MythSocketManager::MythSocketManager() :
5950
m_threadPool("MythSocketManager")
6051
{

mythtv/libs/libmythprotoserver/mythsocketmanager.h

-13
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@
1717
#include "mythsocket.h"
1818
#include "serverpool.h"
1919

20-
class MythServer : public ServerPool
21-
{
22-
Q_OBJECT
23-
public:
24-
explicit MythServer(QObject *parent=nullptr);
25-
26-
signals:
27-
void newConnection(qintptr socket);
28-
29-
protected slots:
30-
void newTcpConnection(qintptr socket) override; // ServerPool
31-
};
32-
3320
class PROTOSERVER_PUBLIC MythSocketManager : public QObject, public MythSocketCBs
3421
{
3522
Q_OBJECT

mythtv/programs/mythbackend/mainserver.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#include "mythversion.h"
5252
#include "mythdb.h"
5353
#include "mainserver.h"
54-
#include "server.h"
54+
#include "serverpool.h"
5555
#include "mthread.h"
5656
#include "scheduler.h"
5757
#include "requesthandler/fileserverutil.h"
@@ -293,7 +293,7 @@ MainServer::MainServer(bool master, int port,
293293
SetExitCode(GENERIC_EXIT_SOCKET_ERROR, false);
294294
return;
295295
}
296-
connect(m_mythserver, &MythServer::NewConnection,
296+
connect(m_mythserver, &MythServer::newConnection,
297297
this, &MainServer::NewConnection);
298298

299299
gCoreContext->addListener(this);

mythtv/programs/mythbackend/mythbackend.pro

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ QMAKE_CLEAN += $(TARGET)
2424

2525
# Input
2626
HEADERS += autoexpire.h encoderlink.h filetransfer.h httpstatus.h mainserver.h
27-
HEADERS += playbacksock.h scheduler.h server.h backendhousekeeper.h
27+
HEADERS += playbacksock.h scheduler.h backendhousekeeper.h
2828
HEADERS += upnpcdstv.h upnpcdsmusic.h upnpcdsvideo.h mediaserver.h
2929
HEADERS += internetContent.h main_helpers.h backendcontext.h
3030
HEADERS += httpconfig.h mythsettings.h commandlineparser.h
@@ -42,7 +42,7 @@ HEADERS += services/capture.h services/image.h services/music.h
4242

4343

4444
SOURCES += autoexpire.cpp encoderlink.cpp filetransfer.cpp httpstatus.cpp
45-
SOURCES += main.cpp mainserver.cpp playbacksock.cpp scheduler.cpp server.cpp
45+
SOURCES += main.cpp mainserver.cpp playbacksock.cpp scheduler.cpp
4646
SOURCES += backendhousekeeper.cpp
4747
SOURCES += upnpcdstv.cpp upnpcdsmusic.cpp upnpcdsvideo.cpp mediaserver.cpp
4848
SOURCES += internetContent.cpp main_helpers.cpp backendcontext.cpp

mythtv/programs/mythbackend/server.cpp

-7
This file was deleted.

mythtv/programs/mythbackend/server.h

-20
This file was deleted.

0 commit comments

Comments
 (0)