projects
/
NeonServV5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/development'
[NeonServV5.git]
/
src
/
QServer.c
diff --git
a/src/QServer.c
b/src/QServer.c
index 1e112332bbf1bed146797caf7ccd1a90fd705543..ef382c98d46cfb945f95c9174df9bc134c9983d2 100644
(file)
--- a/
src/QServer.c
+++ b/
src/QServer.c
@@
-1,4
+1,4
@@
-/* QServer.c - NeonServ v5.
5
+/* QServer.c - NeonServ v5.
6
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
* Copyright (C) 2011-2012 Philipp Kreil (pk910)
*
* This program is free software: you can redistribute it and/or modify
@@
-25,6
+25,7
@@
#include "ConfigParser.h"
#include "bots.h"
#include "IOHandler.h"
#include "ConfigParser.h"
#include "bots.h"
#include "IOHandler.h"
+#include "tools.h"
#ifdef WIN32
typedef uint32_t socklen_t;
#ifdef WIN32
typedef uint32_t socklen_t;
@@
-54,14
+55,16
@@
void qserver_init() {
char *host = get_string_field("QServer.host");
if(!host)
host = "0.0.0.0";
char *host = get_string_field("QServer.host");
if(!host)
host = "0.0.0.0";
- int port
no
= get_int_field("QServer.port");
- if(!port
no
)
- port
no
= 7499;
+ int port = get_int_field("QServer.port");
+ if(!port)
+ port = 7499;
server_iofd = iohandler_listen(host, port, qserver_callback);
}
}
void qserver_free() {
server_iofd = iohandler_listen(host, port, qserver_callback);
}
}
void qserver_free() {
+ if(!server_iofd)
+ return;
struct QServerClient *client, *next;
for (client = qserver_clients; client; client = next) {
next = client->next;
struct QServerClient *client, *next;
for (client = qserver_clients; client; client = next) {
next = client->next;
@@
-87,7
+90,7
@@
static void qserver_put(struct QServerClient *client, const char *text, ...) {
va_list arg_list;
char sendBuf[MAXLEN];
int pos;
va_list arg_list;
char sendBuf[MAXLEN];
int pos;
- if (!
(client && !(client->flags & QSERVER_FLAG_DISCONNECT))
) return;
+ if (!
client || !client->iofd
) return;
sendBuf[0] = '\0';
va_start(arg_list, text);
pos = vsnprintf(sendBuf, MAXLEN - 2, text, arg_list);
sendBuf[0] = '\0';
va_start(arg_list, text);
pos = vsnprintf(sendBuf, MAXLEN - 2, text, arg_list);
@@
-218,7
+221,7
@@
static IOHANDLER_CALLBACK(qserver_callback) {
client->iofd = NULL;
break;
case IOEVENT_ACCEPT:
client->iofd = NULL;
break;
case IOEVENT_ACCEPT:
-
+ qserver_accept(event->data.accept_fd);
break;
default:
break;
break;
default:
break;