Destroy agent on disconnect; another agent can connect later

This commit is contained in:
Petr Baudis 2011-11-26 23:59:31 +01:00
parent cd347a316d
commit 6a3d9b2e4a
3 changed files with 8 additions and 1 deletions

View file

@ -12,5 +12,6 @@ connection::senses(int tick_id, char around[4])
{
char buf[1024];
snprintf(buf, sizeof(buf), "tick %d\naround %c%c%c%c\n\n", tick_id, around[0], around[1], around[2], around[3]);
write(fd, buf, strlen(buf));
if (write(fd, buf, strlen(buf)) < (ssize_t) strlen(buf))
error = true;
}