report irc protocol

pull/14/head
Tom Early 7 years ago
parent 3460826969
commit f2851418d1

@ -53,6 +53,7 @@ const std::string IRCDDB_VERSION("QnetGateway-9.0");
extern void dstar_dv_init(); extern void dstar_dv_init();
extern int dstar_dv_decode(const unsigned char *d, int data[3]); extern int dstar_dv_decode(const unsigned char *d, int data[3]);
extern std::atomic<int> ircsocketfamily;
static std::atomic<bool> keep_running(true); static std::atomic<bool> keep_running(true);
@ -1879,7 +1880,7 @@ void CQnetGateway::Process()
if (keep_running) if (keep_running)
printf("get_irc_data thread started\n"); printf("get_irc_data thread started\n");
ii->kickWatchdog(IRCDDB_VERSION.c_str()); ii->kickWatchdog(IRCDDB_VERSION);
while (keep_running) { while (keep_running) {
ProcessTimeouts(); ProcessTimeouts();
@ -2423,6 +2424,20 @@ bool CQnetGateway::Init(char *cfgfile)
} }
rc = ii->getConnectionState(); rc = ii->getConnectionState();
} }
switch (ircsocketfamily) {
case AF_INET:
printf("IRC server is using IPV4\n");
af_family = AF_INET;
break;
case AF_INET6:
printf("IRC server is using IPV6\n");
af_family = AF_INET6;
break;
default:
printf("IRC server is using unknown protocol!\n");
af_family = AF_UNSPEC;
break;
}
/* udp port 40000 must open first */ /* udp port 40000 must open first */
g2_sock = open_port(g2_external); g2_sock = open_port(g2_external);

@ -3,13 +3,14 @@
#include <netdb.h> #include <netdb.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <atomic>
#include "IRCClient.h" #include "IRCClient.h"
#include "IRCutils.h" #include "IRCutils.h"
#include "../TCPReaderWriterClient.h" #include "../TCPReaderWriterClient.h"
#include <fcntl.h> std::atomic<int> ircsocketfamily;
#include <errno.h>
IRCClient::IRCClient(IRCApplication *app, const std::string &update_channel, const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo) IRCClient::IRCClient(IRCApplication *app, const std::string &update_channel, const std::string &hostName, unsigned int port, const std::string &callsign, const std::string &password, const std::string &versionInfo)
{ {
@ -57,6 +58,7 @@ void IRCClient::Entry()
int state = 0; int state = 0;
int timer = 0; int timer = 0;
socklen_t optlen = sizeof(int);
while (true) { while (true) {
@ -83,6 +85,8 @@ void IRCClient::Entry()
case 4: case 4:
getsockopt(ircSock.GetFD(), SOL_SOCKET, SO_DOMAIN, &ircsocketfamily, &optlen);
recvQ = new IRCMessageQueue(); recvQ = new IRCMessageQueue();
sendQ = new IRCMessageQueue(); sendQ = new IRCMessageQueue();

Loading…
Cancel
Save

Powered by TurnKey Linux.