Hi Mohamed,
> session->transport_watch = g_io_add_watch(session->transport_channel,
> - G_IO_IN | G_IO_HUP | G_IO_NVAL | G_IO_ERR,
> + G_IO_OUT | G_IO_IN | G_IO_HUP | G_IO_NVAL | G_IO_ERR,
> received_data, session);
I have not looked at the whole patch, but you can not do it like this.
You need two watches. One for input which can be always present and one
for output. The output one can only be present when you have data to
write. If you don't have any data, you need to remove that watch again.
If you don't do that, then your application can not go to sleep.
This is important once we are heading for keep alive connections.
So obvious initially you need one G_IO_OUT to detect that we are now
connected, but that is independent from the ones where you need to
actually write data.
> + if (connect(sk, (struct sockaddr *) &sin, sizeof(sin)) < 0 &&
> + errno != EINPROGRESS) {
> + close(sk);
> + return -EIO;
> + }
I prefer if you write these constructs like this:
if (connect(...) < 0) {
if (errno == EINPROGRES)
return 0;
close(sk);
return -EIO;
}
Regards
Marcel
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman