diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-25 16:24:57 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-06-25 16:24:57 +0000 |
| commit | aa864b63aba5260b8bd35da61c543e08ae03bd49 (patch) | |
| tree | fa072c79336b0b74afffa3af9ff30874e67ae3ef /src/client.c | |
| parent | c2c45aad274638acc14e603014f5fc68b13500c5 (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/client.c')
| -rw-r--r-- | src/client.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/client.c b/src/client.c index 138caa0..912b1b0 100644 --- a/src/client.c +++ b/src/client.c @@ -26,7 +26,7 @@ static sock_udp_t *sock_server_udp; static sock_sdl_udp_t *sock_server_sdl_udp; #endif -static buffer_t *clientBuffer; +static list_t *clientBuffer; static my_time_t lastPing; static my_time_t lastPingServerAlive; @@ -34,7 +34,7 @@ static void initClient() { char name[STR_NAME_SIZE]; - clientBuffer = newBuffer( LIMIT_BUFFER ); + clientBuffer = newList(); lastPing = getMyTime(); lastPingServerAlive = getMyTime(); @@ -126,26 +126,31 @@ static int eventServerSelect() } #endif + addList(clientBuffer, strdup(buffer) ); +/* if( addBuffer(clientBuffer, buffer, ret) != 0 ) { fprintf(stderr, "chyba, nemozem zapisovat do mojho buffera !\n"); setWorldEnd(); return ret; } - +*/ return ret; } void eventServerBuffer() { - char line[STR_PROTO_SIZE]; + char *line; + int i; /* obsluha udalosti od servera */ assert( clientBuffer != NULL ); - while ( getBufferLine(clientBuffer, line, STR_PROTO_SIZE) >= 0 ) + for( i = 0 ; i < clientBuffer->count ; i++ ) { + line = (char *)clientBuffer->list[i]; + #ifndef PUBLIC_SERVER if( isParamFlag("--recv") ) { @@ -165,6 +170,9 @@ void eventServerBuffer() lastPingServerAlive = getMyTime(); } + + destroyListItem(clientBuffer, free); + clientBuffer = newList(); } void eventPingServer() @@ -258,7 +266,7 @@ static void quitClient() { proto_send_end_client(); assert( clientBuffer != NULL ); - destroyBuffer(clientBuffer); + destroyListItem(clientBuffer, free); } #ifdef SUPPORT_NET_UNIX_UDP |