summaryrefslogtreecommitdiff
path: root/src/server.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-25 16:24:57 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-25 16:24:57 +0000
commitaa864b63aba5260b8bd35da61c543e08ae03bd49 (patch)
treefa072c79336b0b74afffa3af9ff30874e67ae3ef /src/server.c
parentc2c45aad274638acc14e603014f5fc68b13500c5 (diff)
- kod uz nepouizva buffer_t a buffer.c bol to iba historizmus z pouzivania TCP
( teraz na frontu prijatcy packetov pouizva list_t ) - odstranenie zakrkavacieho GUI "support IPv6", program je schopny zistit sam IP protokol na zaklade IP adresy ( ake logicke, ze ? ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@72 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/server.c b/src/server.c
index 4575381..2480f4b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -258,7 +258,7 @@ static client_t* newAnyClient()
memset(new, 0, sizeof(client_t));
new->status = NET_STATUS_OK;
- new->buffer = newBuffer(LIMIT_BUFFER);
+ new->buffer = newList();
new->lastPing = getMyTime();
new->listCheck = newCheckFront();
@@ -317,7 +317,7 @@ void destroyClient(client_t *p)
closeSdlUdpSocket(p->socket_sdl_udp);
#endif
- destroyBuffer(p->buffer);
+ destroyListItem(p->buffer, free);
destroyCheckFront(p->listCheck);
if( p->tux != NULL )
@@ -583,14 +583,18 @@ static void eventCreateNewSdlUdpClient(sock_sdl_udp_t *socket_sdl_udp)
static void eventClientBuffer(client_t *client)
{
- char line[STR_PROTO_SIZE];
+ char *line;
+ int i;
assert( client != NULL );
/* obsluha udalosti od clientov */
- while( getBufferLine(client->buffer, line, STR_PROTO_SIZE) >= 0 )
+ //while( getBufferLine(client->buffer, line, STR_PROTO_SIZE) >= 0 )
+ for( i = 0 ; i < client->buffer->count ; i++ )
{
+ line = (char *)client->buffer->list[i];
+
#ifndef PUBLIC_SERVER
if( isParamFlag("--recv") )
{
@@ -651,6 +655,9 @@ static void eventClientBuffer(client_t *client)
proto_send_error_server(PROTO_SEND_ONE, client, PROTO_ERROR_CODE_BAD_COMMAND);
}
}
+
+ destroyListItem(client->buffer, free);
+ client->buffer = newList();
}
void eventClientListBuffer()
@@ -735,11 +742,8 @@ static void eventClientUdpSelect(sock_udp_t *sock_server)
return;
}
- if( addBuffer(client->buffer, buffer, ret) != 0 )
- {
- client->status = NET_STATUS_ZOMBIE;
- return;
- }
+ //printf("add packet >>%s<<\n", buffer);
+ addList(client->buffer, strdup(buffer) );
}
void selectServerUdpSocket()
@@ -904,12 +908,7 @@ void selectServerSdlUdpSocket()
return;
}
- if( addBuffer(client->buffer, buffer, ret) != 0 )
- {
- client->status = NET_STATUS_ZOMBIE;
- return;
- }
-
+ addList(client->buffer, strdup(buffer) );
}while( ret > 0 );
}