-# $Id: GNUmakefile,v 1.3 2014/06/25 14:25:42 mmondor Exp $
+# $Id: GNUmakefile,v 1.4 2014/06/30 18:45:31 mmondor Exp $
MMLIB_PATH := ../../mmlib
$(addprefix ../common/,hmac_sha1.o hmac_rmd160.o sha1.o rmd160.o \
mmenc.o)
CFLAGS += -Wall -g
+LDFLAGS += -g
BINS := tms-server
all: $(BINS)
tms-server: $(MMLIBS) $(LIBS) $(OBJS)
- cc -o $@ $(MMLIBS) $(OBJS) $(LIBS)
+ cc -o $@ $(MMLIBS) $(OBJS) $(LIBS) $(CFLAGS) $(LDFLAGS)
clean:
-/* $Id: client.c,v 1.6 2014/06/25 12:53:14 mmondor Exp $ */
+/* $Id: client.c,v 1.7 2014/06/30 18:45:31 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
DLIST_SWAP(&clients_gc_list, &clients_list, (node_t *)c, FALSE);
}
+inline bool
+client_marked(client_t *c)
+{
+
+ return (c->todestroy || c->toclose);
+}
+
void
client_destroy_marked(void)
{
-/* $Id: client.h,v 1.2 2007/12/05 23:47:57 mmondor Exp $ */
+/* $Id: client.h,v 1.3 2014/06/30 18:45:31 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
#include <sys/types.h>
#include <sys/socket.h>
+#include <stdbool.h>
#include <stdint.h>
#include <time.h>
client_t *client_create(int, struct sockaddr *);
void client_destroy_mark(client_t *);
+inline bool client_marked(client_t *);
void client_destroy_marked(void);
void client_timeout(void);
-/* $Id: kqueue.c,v 1.3 2014/06/22 10:24:29 mmondor Exp $ */
+/* $Id: kqueue.c,v 1.4 2014/06/30 18:45:31 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
* for this purpose.
*/
if ((c = (client_t *)kev->udata) == NULL ||
- c->todestroy)
+ client_marked(c))
continue;
if ((kev->flags & EV_EOF) != 0) {
-/* $Id: packets.c,v 1.7 2014/06/26 03:46:37 mmondor Exp $ */
+/* $Id: packets.c,v 1.8 2014/06/30 18:45:31 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
for (c = (client_t *)DLIST_TOP(&clients_list); c != NULL; c = next) {
next = DLIST_NEXT((node_t *)c);
- if (c->todestroy || c->toclose)
+ if (client_marked(c))
continue;
/* Check for ship/ship collisions */
for (c2 = (client_t *)DLIST_TOP(&clients_list); c2 != NULL;
c2 = next2) {
next2 = DLIST_NEXT((node_t *)c2);
+
+ if (client_marked(c2))
+ continue;
if (c2 != c) {
ship_t *s1 = &c->ship, *s2 = &c2->ship;
int x1 = s1->x, y1 = s1->y,
}
}
}
- if (c->todestroy)
- continue;
/* Reset ping request throttling flag */
c->askedping = 0;
-/* $Id: torp.c,v 1.6 2014/06/30 03:37:35 mmondor Exp $ */
+/* $Id: torp.c,v 1.7 2014/06/30 18:45:31 mmondor Exp $ */
/*
* Copyright (c) 2006, Matthew Mondor
ship_t *s = &c->ship;
int sx = s->x, sy = s->y, sr = s->ship->radius;
- if (c->todestroy || c->toclose)
+ if (client_marked(c))
continue;
if (square_intersect(tx, ty, tr, sx, sy, sr) &&