Skip to content

Commit

Permalink
extract CServiceEntry into separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
zerotacg committed Jun 8, 2024
1 parent ddee279 commit 1a45228
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
23 changes: 2 additions & 21 deletions nelns/naming_service/naming_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include "nel/net/service.h"
#include "nel/net/module_manager.h"

#include "service_entry.h"

//
// Namespaces
//
Expand All @@ -70,27 +72,6 @@ NLMISC_COMMAND(test, "none", "none")
}


//
// Structures
//

struct CServiceEntry
{
CServiceEntry (TSockId sock, const vector<CInetAddress> &a, const string &n, TServiceId s) : SockId(sock), Addr(a), Name(n), SId (s), WaitingUnregistration(false) { }

TSockId SockId; // the connection between the service and the naming service
vector<CInetAddress> Addr; // address to send to the service who wants to lookup this service
// it s possible to have more than one addr, anyway, the naming service
// will send good address depending of the sub net address of the service
string Name; // name of the service
TServiceId SId; // id of the service

bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK)
TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process
list<TServiceId> WaitingUnregistrationServices; // list of service that we wait the answer
};



// Helper that emulates layer5's send()
//void sendToService( uint16 sid, CMessage& msgout );
Expand Down
35 changes: 35 additions & 0 deletions nelns/naming_service/service_entry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef NL_SERVICE_ENTRY_H
#define NL_SERVICE_ENTRY_H

#include <list>
#include <string>

#include <nel/misc/time_nl.h>
#include <nel/net/buf_sock.h>
#include <nel/net/inet_address.h>
#include <nel/net/unified_network.h>

struct CServiceEntry
{
CServiceEntry(NLNET::TSockId sock, const std::vector<NLNET::CInetAddress> &a, const std::string &n, NLNET::TServiceId s)
: SockId(sock)
, Addr(a)
, Name(n)
, SId(s)
, WaitingUnregistration(false)
{
}

NLNET::TSockId SockId; // the connection between the service and the naming service
std::vector<NLNET::CInetAddress> Addr; // address to send to the service who wants to lookup this service
// it s possible to have more than one addr, anyway, the naming service
// will send good address depending of the sub net address of the service
std::string Name; // name of the service
NLNET::TServiceId SId; // id of the service

bool WaitingUnregistration; // true if this service is in unregistration process (wait other service ACK)
NLMISC::TTime WaitingUnregistrationTime; // time of the beginning of the inregistration process
std::list<NLNET::TServiceId> WaitingUnregistrationServices; // list of service that we wait the answer
};

#endif // NL_SERVICE_ENTRY_H

0 comments on commit 1a45228

Please sign in to comment.