-/* 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
char *host = get_string_field("QServer.host");
if(!host)
host = "0.0.0.0";
- int portno = get_int_field("QServer.port");
- if(!portno)
- portno = 7499;
+ int port = get_int_field("QServer.port");
+ if(!port)
+ port = 7499;
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;
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);
client->iofd = NULL;
break;
case IOEVENT_ACCEPT:
-
+ qserver_accept(event->data.accept_fd);
break;
default:
break;