linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] [PATCH]ortp - shutdown() pipe fd before closing it


From: Maciej S. Szmigiero
Subject: [Linphone-developers] [PATCH]ortp - shutdown() pipe fd before closing it
Date: Fri, 10 Jan 2014 23:49:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0

Hello,

When using linphonec with command pipe enabled on Linux most of the time it 
will hang 
when shutting down using console "quit" command.

This is caused by pipe thread being blocked on accept() (via 
ortp_server_pipe_accept_client())
and main thread waiting for pipe thread finish in stop_pipe_reader().

The main thread calls ortp_server_pipe_close() on pipe fd before waiting which 
removes the
socket file and closes its fd.

Unfortunately, at least on Linux closing a socket fd from one thread is not 
enough to make a blocking
call from other thread on this fd exit with error.
The workaround is to issue a shutdown() on the socket fs before closing it in 
ortp_server_pipe_close(),
which the attached patch does.

With it applied the linphonec exits reliably on Linux when shut down using 
console "quit" command.

Best regards,
Maciej Szmigiero

Attachment: ortp-shutdown-server-pipe-before-closing.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]