[RFC wayland 13/18] connections: Add remote sockets

Pekka Paalanen ppaalanen at gmail.com
Wed Feb 10 13:33:48 UTC 2016


On Tue,  9 Feb 2016 10:56:00 -0600
Derek Foreman <derekf at osg.samsung.com> wrote:

> This allows adding a tcp/ip socket and adds tracking of the remote status
> for clients and proxies
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
>  src/connection.c          |  11 +++-
>  src/wayland-client.c      | 103 +++++++++++++++++++++++++-------
>  src/wayland-private.h     |   5 ++
>  src/wayland-server-core.h |   7 +++
>  src/wayland-server.c      | 146 ++++++++++++++++++++++++++++++++++++----------
>  5 files changed, 221 insertions(+), 51 deletions(-)
> 
> diff --git a/src/connection.c b/src/connection.c
> index 05806b6..5fd085f 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -39,6 +39,7 @@
>  #include <sys/socket.h>
>  #include <time.h>
>  #include <ffi.h>
> +#include <stdbool.h>
>  
>  #include "wayland-util.h"
>  #include "wayland-private.h"
> @@ -61,6 +62,7 @@ struct wl_connection {
>  	struct wl_buffer fds_in, fds_out;
>  	int fd;
>  	int want_flush;
> +	bool remote;
>  };
>  
>  static int
> @@ -191,6 +193,12 @@ close_fds(struct wl_buffer *buffer, int max)
>  	buffer->tail += size;
>  }
>  
> +void
> +wl_connection_set_remote(struct wl_connection *connection)
> +{
> +	connection->remote = true;
> +}
> +
>  int
>  wl_connection_destroy(struct wl_connection *connection)
>  {
> @@ -278,6 +286,7 @@ wl_connection_flush(struct wl_connection *connection)
>  	char cmsg[CLEN];
>  	int len = 0, count, clen;
>  	uint32_t tail;
> +	int wait = connection->remote ? 0 : MSG_DONTWAIT;
>  
>  	if (!connection->want_flush)
>  		return 0;
> @@ -298,7 +307,7 @@ wl_connection_flush(struct wl_connection *connection)
>  
>  		do {
>  			len = sendmsg(connection->fd, &msg,
> -				      MSG_NOSIGNAL | MSG_DONTWAIT);
> +				      MSG_NOSIGNAL | wait);

Hi,

why do you want to block for remote?

Could this be because something isn't polling for writable properly?
Or don't we support that somehow?

>  		} while (len == -1 && errno == EINTR);
>  
>  		if (len == -1)


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160210/041e8e36/attachment.sig>


More information about the wayland-devel mailing list