AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ACSoap.h File Reference
#include "Define.h"
#include <future>
#include <mutex>

Go to the source code of this file.

Classes

class  SOAPCommand
 

Functions

void process_message (struct soap *soap_message)
 
void ACSoapThread (const std::string &host, uint16 port)
 

Function Documentation

◆ ACSoapThread()

void ACSoapThread ( const std::string &  host,
uint16  port 
)
25{
26 struct soap soap;
27 soap_init(&soap);
28 soap_set_imode(&soap, SOAP_C_UTFSTRING);
29 soap_set_omode(&soap, SOAP_C_UTFSTRING);
30
31 // check every 3 seconds if world ended
32 soap.accept_timeout = 3;
33 soap.recv_timeout = 5;
34 soap.send_timeout = 5;
35
36 if (!soap_valid_socket(soap_bind(&soap, host.c_str(), port, 100)))
37 {
38 LOG_ERROR("network.soap", "ACSoap: couldn't bind to {}:{}", host, port);
39 exit(-1);
40 }
41
42 LOG_INFO("network.soap", "ACSoap: bound to http://{}:{}", host, port);
43
44 while (!World::IsStopped())
45 {
46 if (!soap_valid_socket(soap_accept(&soap)))
47 continue; // ran into an accept timeout
48
49 LOG_DEBUG("network.soap", "ACSoap: accepted connection from IP={}.{}.{}.{}", (int)(soap.ip >> 24) & 0xFF, (int)(soap.ip >> 16) & 0xFF, (int)(soap.ip >> 8) & 0xFF, (int)soap.ip & 0xFF);
50 struct soap* thread_soap = soap_copy(&soap);// make a safe copy
51
52 process_message(thread_soap);
53 }
54
55 soap_destroy(&soap);
56 soap_end(&soap);
57 soap_done(&soap);
58}
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
void process_message(struct soap *soap_message)
Definition: ACSoap.cpp:60
static bool IsStopped()
Definition: World.h:260

References World::IsStopped(), LOG_DEBUG, LOG_ERROR, LOG_INFO, and process_message().

Referenced by main().

◆ process_message()

void process_message ( struct soap *  soap_message)
61{
62 LOG_TRACE("network.soap", "SOAPWorkingThread::process_message");
63
64 soap_serve(soap_message);
65 soap_destroy(soap_message); // dealloc C++ data
66 soap_end(soap_message); // dealloc data and clean up
67 soap_free(soap_message); // detach soap struct and fre up the memory
68}
#define LOG_TRACE(filterType__,...)
Definition: Log.h:173

References LOG_TRACE.

Referenced by ACSoapThread().