[asterisk-dev] [Code Review] 3402: http: response body frequently missing when running in virtual machine

Matt Jordan reviewboard at asterisk.org
Wed Mar 26 15:38:20 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3402/#review11384
-----------------------------------------------------------



/branches/12/main/http.c
<https://reviewboard.asterisk.org/r/3402/#comment21031>

    I'm not sure why the send-only shutdown of ser->fd is needed here.
    
    When the file stream is closed via fclose(ser->f), the file descriptor is implicitly closed as well.
    
    From http://linux.die.net/man/3/fdopen:
    
    "The file descriptor is not dup'ed, and will be closed when the stream created by fdopen() is closed."
    
    I'm not sure why the fflush is strictly necessary here as well, as closing should flush the file stream.


- Matt Jordan


On March 26, 2014, 3:13 p.m., Scott Griepentrog wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3402/
> -----------------------------------------------------------
> 
> (Updated March 26, 2014, 3:13 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: SWP-6767
>     https://issues.asterisk.org/jira/browse/SWP-6767
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> When running asterisk in a virtual machine, responses to ARI requests would frequently be missing.  A race condition related to closing the socket immediately after writing data onto it is resolved in this patch by insuring the output stream is flushed, and then informing TCP of the shutdown prior to the close.
> 
> 
> Diffs
> -----
> 
>   /branches/12/main/http.c 411242 
> 
> Diff: https://reviewboard.asterisk.org/r/3402/diff/
> 
> 
> Testing
> -------
> 
> Tested on Ubuntu server 12.04 with Sam's json api test from issue.
> 
> 
> Thanks,
> 
> Scott Griepentrog
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140326/d19cf750/attachment.html>


More information about the asterisk-dev mailing list