On Mon, 2006-09-11 at 22:47 +0100, Pedro Alves wrote:
> Hi all,
> 
> In librapi2/src/invoke.c, at:
> 
> static HRESULT CeRapiInvokeBuffers(...)
> {
>   (...)
> 
>   /* XXX: is this really the right way? */
>   shutdown(synce_socket_get_descriptor(context->socket), SHUT_WR);
> 
>   if ( !rapi_buffer_recv(context->recv_buffer, context->socket) )  // 
> ******* This fails on me on current trunk.
>   {
>     synce_error("rapi_buffer_recv failed");
>     hr = E_FAIL;
>     goto exit;
>   }
> 
>   (...)
> }
> 
> The rapi_buffer_recv fails on me on current trunk, because 
> shutdown(SHUT_WR) was
> called, which I guess sends a FIN, that ends up returning  
> EVENT_READ|EVENT_ERROR,
> from the poll inside synce_socket_wait. The EVENT_ERROR is normal in 
> this case AFAIK,
> and the data associated with the EVENT_READ is valid data.
> 
> librapi2/src/support/rapi_buffer.c:
> 
> bool rapi_buffer_recv(RapiBuffer* buffer, SynceSocket* socket)
> {
>     uint32_t      size_le = 0;
>     size_t         size    = 0;
>     unsigned char* data    = NULL;
>   short         events = EVENT_READ;
> 
>   if (!synce_socket_wait(socket, 15, &events))
>   {
>     rapi_buffer_error("Failed to wait for event");
>     goto fail;
>   }
> 
>   if (events != EVENT_READ) // ********  wrong, valid data discarded.
>   {
>     rapi_buffer_error("Nothing to read. Events = %i", events);
>     goto fail;
>   }
> 
>   (...)
> }
> 
> 
> The attached proposed patches fixes this, and my app is now returning 
> correct data
> from CeRapiInvoke block/buffer mode, whatever it is called these days.

Comitted, thanks!

\David
-- 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Synce-devel mailing list
Synce-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synce-devel

Reply via email to