mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
libeventserver: formatting code using astyle
Origin commit data
------------------
Branch: ni/coolstream
Commit: 34627f15d8
Author: vanhofen <vanhofen@gmx.de>
Date: 2023-01-31 (Tue, 31 Jan 2023)
Origin message was:
------------------
- libeventserver: formatting code using astyle
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -40,8 +40,8 @@ void CEventServer::registerEvent(const int fd)
|
||||
{
|
||||
commandRegisterEvent msg;
|
||||
|
||||
int readresult= read(fd, &msg, sizeof(msg));
|
||||
if ( readresult<= 0 )
|
||||
int readresult = read(fd, &msg, sizeof(msg));
|
||||
if (readresult <= 0)
|
||||
perror("[eventserver]: read");
|
||||
// printf("[eventserver]: read from %d %x bytes %d/%d\n", fd, errno, readresult, sizeof(msg));
|
||||
// printf("[eventserver]: registered event (%d) to: %d - %s\n", msg.eventID, msg.clientID, msg.udsName);
|
||||
@@ -50,7 +50,7 @@ void CEventServer::registerEvent(const int fd)
|
||||
|
||||
void CEventServer::unRegisterEvent2(const unsigned int eventID, const unsigned int ClientID)
|
||||
{
|
||||
eventData[eventID].erase( ClientID );
|
||||
eventData[eventID].erase(ClientID);
|
||||
}
|
||||
|
||||
void CEventServer::unRegisterEvent(const int fd)
|
||||
@@ -60,11 +60,11 @@ void CEventServer::unRegisterEvent(const int fd)
|
||||
unRegisterEvent2(msg.eventID, msg.clientID);
|
||||
}
|
||||
|
||||
void CEventServer::sendEvent(const unsigned int eventID, const initiators initiatorID, const void* eventbody, const unsigned int eventbodysize)
|
||||
void CEventServer::sendEvent(const unsigned int eventID, const initiators initiatorID, const void *eventbody, const unsigned int eventbodysize)
|
||||
{
|
||||
eventClientMap notifyClients = eventData[eventID];
|
||||
|
||||
for(eventClientMap::iterator pos = notifyClients.begin(); pos != notifyClients.end(); ++pos)
|
||||
for (eventClientMap::iterator pos = notifyClients.begin(); pos != notifyClients.end(); ++pos)
|
||||
{
|
||||
//allen clients ein event schicken
|
||||
eventClient client = pos->second;
|
||||
@@ -73,7 +73,7 @@ void CEventServer::sendEvent(const unsigned int eventID, const initiators initia
|
||||
}
|
||||
|
||||
|
||||
bool CEventServer::sendEvent2Client(const unsigned int eventID, const initiators initiatorID, const eventClient* ClientData, const void* eventbody, const unsigned int eventbodysize)
|
||||
bool CEventServer::sendEvent2Client(const unsigned int eventID, const initiators initiatorID, const eventClient *ClientData, const void *eventbody, const unsigned int eventbodysize)
|
||||
{
|
||||
struct sockaddr_un servaddr;
|
||||
int clilen, sock_fd;
|
||||
@@ -89,7 +89,7 @@ bool CEventServer::sendEvent2Client(const unsigned int eventID, const initiators
|
||||
return false;
|
||||
}
|
||||
|
||||
if(connect(sock_fd, (struct sockaddr*) &servaddr, clilen) <0 )
|
||||
if (connect(sock_fd, (struct sockaddr *) &servaddr, clilen) < 0)
|
||||
{
|
||||
char errmsg[128];
|
||||
snprintf(errmsg, 128, "[eventserver]: connect (%s)", ClientData->udsName);
|
||||
@@ -106,7 +106,7 @@ bool CEventServer::sendEvent2Client(const unsigned int eventID, const initiators
|
||||
ssize_t ignored __attribute__((unused)) = write(sock_fd, &head, sizeof(head));
|
||||
// printf ("[eventserver]: sent 0x%x - following eventbody= %d\n", written, eventbodysize );
|
||||
|
||||
if(eventbodysize!=0)
|
||||
if (eventbodysize != 0)
|
||||
{
|
||||
/*written = */
|
||||
ignored = write(sock_fd, eventbody, eventbodysize);
|
||||
|
@@ -34,9 +34,9 @@
|
||||
|
||||
class CEventServer
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
enum initiators
|
||||
enum initiators
|
||||
{
|
||||
INITID_CONTROLD,
|
||||
INITID_SECTIONSD,
|
||||
@@ -48,46 +48,46 @@ class CEventServer
|
||||
};
|
||||
|
||||
|
||||
struct commandRegisterEvent
|
||||
{
|
||||
unsigned int eventID;
|
||||
unsigned int clientID;
|
||||
char udsName[50];
|
||||
};
|
||||
struct commandRegisterEvent
|
||||
{
|
||||
unsigned int eventID;
|
||||
unsigned int clientID;
|
||||
char udsName[50];
|
||||
};
|
||||
|
||||
struct commandUnRegisterEvent
|
||||
{
|
||||
unsigned int eventID;
|
||||
unsigned int clientID;
|
||||
};
|
||||
struct commandUnRegisterEvent
|
||||
{
|
||||
unsigned int eventID;
|
||||
unsigned int clientID;
|
||||
};
|
||||
|
||||
struct eventHead
|
||||
{
|
||||
unsigned int eventID;
|
||||
unsigned int initiatorID;
|
||||
unsigned int dataSize;
|
||||
};
|
||||
struct eventHead
|
||||
{
|
||||
unsigned int eventID;
|
||||
unsigned int initiatorID;
|
||||
unsigned int dataSize;
|
||||
};
|
||||
|
||||
void registerEvent2(const unsigned int eventID, const unsigned int ClientID, const std::string &udsName);
|
||||
void registerEvent(const int fd);
|
||||
void unRegisterEvent2(const unsigned int eventID, const unsigned int ClientID);
|
||||
void unRegisterEvent(const int fd);
|
||||
void sendEvent(const unsigned int eventID, const initiators initiatorID, const void* eventbody = NULL, const unsigned int eventbodysize = 0);
|
||||
void registerEvent2(const unsigned int eventID, const unsigned int ClientID, const std::string &udsName);
|
||||
void registerEvent(const int fd);
|
||||
void unRegisterEvent2(const unsigned int eventID, const unsigned int ClientID);
|
||||
void unRegisterEvent(const int fd);
|
||||
void sendEvent(const unsigned int eventID, const initiators initiatorID, const void *eventbody = NULL, const unsigned int eventbodysize = 0);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
struct eventClient
|
||||
{
|
||||
char udsName[50];
|
||||
};
|
||||
struct eventClient
|
||||
{
|
||||
char udsName[50];
|
||||
};
|
||||
|
||||
//key: ClientID // Map is a Sorted Associative Container
|
||||
typedef std::map<unsigned int, eventClient> eventClientMap; // -> clients with lower ClientID receive events first
|
||||
//key: ClientID // Map is a Sorted Associative Container
|
||||
typedef std::map<unsigned int, eventClient> eventClientMap; // -> clients with lower ClientID receive events first
|
||||
|
||||
//key: eventID
|
||||
std::map<unsigned int, eventClientMap> eventData;
|
||||
//key: eventID
|
||||
std::map<unsigned int, eventClientMap> eventData;
|
||||
|
||||
bool sendEvent2Client(const unsigned int eventID, const initiators initiatorID, const eventClient* ClientData, const void* eventbody = NULL, const unsigned int eventbodysize = 0);
|
||||
bool sendEvent2Client(const unsigned int eventID, const initiators initiatorID, const eventClient *ClientData, const void *eventbody = NULL, const unsigned int eventbodysize = 0);
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user