[Xitami-Dev] read_TCP returns 0 instead of -1

D'Hoye, Peter xitami-dev@lists.xitami.org
Wed, 12 Jun 2002 11:08:50 +0200


Rafael,

thanks for this obvious fix. I'm using LRWP to create
a web-interface for a machine we make, and I saw the
LRWP client go in a loop when Xitami was restarted.
I didn't have any time to investigate, thanks to you
I can scratch another bug from my to-do list :-)

PS: Pieter, we all mis Liberetto !!!

> -----Original Message-----
> From: Rafael Cano Pérez [mailto:rafael.cano@o-labs.com]
> Sent: vrijdag 7 juni 2002 16:40
> To: Xitami devel
> Subject: [Xitami-Dev] read_TCP returns 0 instead of -1
> 
> 
> 
>  Hello Imatix.
> 
>  I am using lrwplib.c for a prototype LRWP application,
>  wich will be later implementing the LRWP via an
>  SMT agent.
> 
>  In read_full_TCP() in lrwplib.c, after calling
>  read_TCP() reads the return code, and compares
>  it to SOCKET_ERROR for errors. This macro
>  is defined in sfl.h as -1, but when the socket is
>  closed, for example when xitami is closed, read_TCP
>  returns 0, making any application based on lrwplib.c
>  go into an infinite loop.
>  Changing the test against 0
>  ...
>  if (chunkLen == 0)
>   return SOCKET_ERROR;
>  ...
> 
>  fixes the error.
> 
>  A bug in sfl.h, lrwplib.c or read_TCP() ??