Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-11 Thread Lorn Potter

> On 12 Nov 2015, at 9:50 am, Aaron McCarthy  wrote:
> 
> Hi,
> 
> On Wed, 11 Nov 2015 16:20:11 Alexander Ladygin wrote:
>> I probably didn't make myself clear =(
>> 1) wifi is turned on
>> 2) app is launched, i can download files with QNAM
>> 3) app is still launched, i turn off the wifi (mobile network activated)
>> 4) i can no longer download any files. No network errors, but QNAM's reply
>> returns empty files
> 
> Does the reply emit the finished() signal? I ask because I would expect the 
> reply to either finish with an error or hang attempting to use the previous 
> connection.
> 
> You could try using tcpdump or strace to check what QNAM is actually doing at 
> the socket level. It might give more of a clue as to what is going wrong.
> 

It’s not at that level.

I’ve been working on this today. I haven’t created a bug about it yet.

There are a few things going on in QNAM with regards to it’s NetworkSession and 
timing of when configurations become active and non active.

-
Lorn
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-11 Thread Aaron McCarthy
Hi,

On Wed, 11 Nov 2015 16:20:11 Alexander Ladygin wrote:
> I probably didn't make myself clear =(
> 1) wifi is turned on
> 2) app is launched, i can download files with QNAM
> 3) app is still launched, i turn off the wifi (mobile network activated)
> 4) i can no longer download any files. No network errors, but QNAM's reply
> returns empty files

Does the reply emit the finished() signal? I ask because I would expect the 
reply to either finish with an error or hang attempting to use the previous 
connection.

You could try using tcpdump or strace to check what QNAM is actually doing at 
the socket level. It might give more of a clue as to what is going wrong.

Cheers,

-- 
Aaron McCarthy
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-11 Thread Alexander Ladygin
Hei Lorn

I probably didn't make myself clear =(
1) wifi is turned on
2) app is launched, i can download files with QNAM
3) app is still launched, i turn off the wifi (mobile network activated)
4) i can no longer download any files. No network errors, but QNAM's reply
returns empty files
5) turn the wifi back on - i can download files

When wifi is turned off, i've tried:
1) creating new instance: _pManager = new QNetworkAccessManager(this);
2) clearing access cache: _pManager->clearAccessCache();
3) updating network configuration: _configManager.updateConfigurations()
and then

QList activeConfigs =
_configManager.allConfigurations(QNetworkConfiguration::Active);
if (activeConfigs.count() > 0) {
_pManager->setConfiguration(activeConfigs.at(0));
qDebug() << "QNetworkConfiguration = " << activeConfigs.at(0).name();
}
In that case qDebug shows that active configuration is, indeed, mobile
network

But nothing helped. Only restarting app helps

Maybe you can look at sources, if you have couple of spare minutes
https://github.com/virgi26/harbour-vk-music/blob/master/src/downloadmanager.cpp
Thank you for your time.

Alex.


On Wed, Nov 11, 2015 at 1:13 PM, Lorn Potter  wrote:

>
> > On 11 Nov 2015, at 8:09 pm, Lorn Potter  wrote:
> >
> > Hi Alex,
> >
> > Having tested this, it does seem to be a bug in that when connecting to
> wlan
>
> I should have specified here when already connected to mobile data and
> then connecting to wlan without first disconnecting mobile data.
>
>
> > , QNAM’s networkAccessibility sometimes will go to NotAccessible, but
> then go to Accessible when wlan connects. or sometimes it won’t even go to
> NotAccessible then Accessible when wlan is connected.
> >
> > You should be able to track QNAM through its networkAccessibilty
> property. it should follow the online state, unless you specifically set it
> to NotAccessible.
> >
> > QNAM uses QNetworkConfiguration internally, and it should automatically
> switch this to the current Active configuration.
> >
> >
> > -
> > Lorn
> >
> >> On 10 Nov 2015, at 10:37 am, Alexander Ladygin 
> wrote:
> >>
> >> Hey!
> >>
> >> I've got an issue: QNetworkAccessManager is losing connection upon
> switching between wifi and mobile:( What exactly should i do/update to make
> it work properly? Maybe need to change network configuration? Why it is not
> handled by platform?
> >> Thanks.
> >>
> >> Alex
> >> ___
> >> SailfishOS.org Devel mailing list
> >> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
> >
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-11 Thread Lorn Potter

> On 11 Nov 2015, at 8:09 pm, Lorn Potter  wrote:
> 
> Hi Alex,
> 
> Having tested this, it does seem to be a bug in that when connecting to wlan

I should have specified here when already connected to mobile data and then 
connecting to wlan without first disconnecting mobile data.


> , QNAM’s networkAccessibility sometimes will go to NotAccessible, but then go 
> to Accessible when wlan connects. or sometimes it won’t even go to 
> NotAccessible then Accessible when wlan is connected.
> 
> You should be able to track QNAM through its networkAccessibilty property. it 
> should follow the online state, unless you specifically set it to 
> NotAccessible.
> 
> QNAM uses QNetworkConfiguration internally, and it should automatically 
> switch this to the current Active configuration.
> 
> 
> -
> Lorn
> 
>> On 10 Nov 2015, at 10:37 am, Alexander Ladygin  wrote:
>> 
>> Hey!
>> 
>> I've got an issue: QNetworkAccessManager is losing connection upon switching 
>> between wifi and mobile:( What exactly should i do/update to make it work 
>> properly? Maybe need to change network configuration? Why it is not handled 
>> by platform?
>> Thanks.
>> 
>> Alex
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
> 

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-11 Thread Lorn Potter
Hi Alex,

Having tested this, it does seem to be a bug in that when connecting to wlan, 
QNAM’s networkAccessibility sometimes will go to NotAccessible, but then go to 
Accessible when wlan connects. or sometimes it won’t even go to NotAccessible 
then Accessible when wlan is connected.

You should be able to track QNAM through its networkAccessibilty property. it 
should follow the online state, unless you specifically set it to NotAccessible.

QNAM uses QNetworkConfiguration internally, and it should automatically switch 
this to the current Active configuration.


-
Lorn

> On 10 Nov 2015, at 10:37 am, Alexander Ladygin  wrote:
> 
> Hey!
> 
> I've got an issue: QNetworkAccessManager is losing connection upon switching 
> between wifi and mobile:( What exactly should i do/update to make it work 
> properly? Maybe need to change network configuration? Why it is not handled 
> by platform?
> Thanks.
> 
> Alex
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-11 Thread Alexander Ladygin
I've added some debugging. Strangely i'm not actually getting any errors,
but when i try to download a file (that's the sole purpose of QNAM in my
app), i'm getting an empty one. Any thoughts?
PS if close my app and open it again it downloads same file with same url
without any problems whatsoever.

Alex

On Wed, Nov 11, 2015 at 3:36 AM, Aaron McCarthy 
wrote:

> Hi,
>
> On Tue, 10 Nov 2015 11:07:51 Alexander Ladygin wrote:
> > but how exactly can i make disconnect? All the network requests i send
> with
> > QNetworkAccessManager after switching to mobile are returned with errors
> =(
>
> What errors are being returned? Are you explicitly setting a network
> configuration or relying on QNAM default behaviour? What online state is
> QNAM
> reporting when the errors occur?
>
> Cheers,
>
> --
> Aaron McCarthy
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-10 Thread Aaron McCarthy
Hi,

On Tue, 10 Nov 2015 11:07:51 Alexander Ladygin wrote:
> but how exactly can i make disconnect? All the network requests i send with
> QNetworkAccessManager after switching to mobile are returned with errors =(

What errors are being returned? Are you explicitly setting a network 
configuration or relying on QNAM default behaviour? What online state is QNAM 
reporting when the errors occur?

Cheers,

-- 
Aaron McCarthy
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-10 Thread Alexander Ladygin
nd? =)
The question is how to make QNetworkAccessManager work

On Tue, Nov 10, 2015 at 1:38 PM, Andrey Kozhevnikov 
wrote:

> QNetworkConfigurationManager have signal: onlineStateChanged(bool)
>
> -- Исходное сообщение --
> От: "Alexander Ladygin" 
> Кому: aaron.mccar...@jolla.com; "Sailfish OS Developers" <
> devel@lists.sailfishos.org>
> Отправлено: 10.11.2015 14:06:12
> Тема: Re: [SailfishDevel] QNetworkAccessManager is losing connection upon
> switching between wifi and mobile
>
>
> in addition: even if i create new object instance for QNetworkAccessManager,
> it still won't connect to internet, as if it still uses WiFi "globally"
> even though wifi is off
>
> On Tue, Nov 10, 2015 at 11:07 AM, Alexander Ladygin 
> wrote:
>
>> but how exactly can i make disconnect? All the network requests i send
>> with QNetworkAccessManager after switching to mobile are returned with
>> errors =(
>>
>> On Tue, Nov 10, 2015 at 4:05 AM, Aaron McCarthy > > wrote:
>>
>>> On Tue, 10 Nov 2015 03:37:10 Alexander Ladygin wrote:
>>> > I've got an issue: QNetworkAccessManager is losing connection upon
>>> > switching between wifi and mobile:( What exactly should i do/update to
>>> make
>>> > it work properly? Maybe need to change network configuration? Why it
>>> is not
>>> > handled by platform?
>>>
>>> There is some support for migrating connections to the new interface.
>>> QNAM
>>> supports resuming GET operations under the following conditions:
>>>
>>> 1. Only GET requests are resumed.
>>> 2. No outgoing data.
>>> 3. Server supports HTTP Accept-Ranges.
>>> 4. Does not work with QNAM's zero-copy feature.
>>> 5. Must be using bearer management.
>>>
>>> For other operations and GET requests that do not meet the above, you
>>> will
>>> need to handle the network disconnection and resend the request.
>>>
>>> Cheers,
>>>
>>> --
>>> Aaron McCarthy
>>> ___
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>>
>>
>>
>
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-10 Thread Andrey Kozhevnikov

QNetworkConfigurationManager have signal: onlineStateChanged(bool)

-- Исходное сообщение --
От: "Alexander Ladygin" 
Кому: aaron.mccar...@jolla.com; "Sailfish OS Developers" 


Отправлено: 10.11.2015 14:06:12
Тема: Re: [SailfishDevel] QNetworkAccessManager is losing connection 
upon switching between wifi and mobile


in addition: even if i create new object instance for 
QNetworkAccessManager, it still won't connect to internet, as if it 
still uses WiFi "globally" even though wifi is off


On Tue, Nov 10, 2015 at 11:07 AM, Alexander Ladygin  
wrote:
but how exactly can i make disconnect? All the network requests i send 
with QNetworkAccessManager after switching to mobile are returned with 
errors =(


On Tue, Nov 10, 2015 at 4:05 AM, Aaron McCarthy 
 wrote:

On Tue, 10 Nov 2015 03:37:10 Alexander Ladygin wrote:
> I've got an issue: QNetworkAccessManager is losing connection upon
> switching between wifi and mobile:( What exactly should i do/update 
to make
> it work properly? Maybe need to change network configuration? Why 
it is not

> handled by platform?

There is some support for migrating connections to the new interface. 
QNAM

supports resuming GET operations under the following conditions:

1. Only GET requests are resumed.
2. No outgoing data.
3. Server supports HTTP Accept-Ranges.
4. Does not work with QNAM's zero-copy feature.
5. Must be using bearer management.

For other operations and GET requests that do not meet the above, you 
will

need to handle the network disconnection and resend the request.

Cheers,

--
Aaron McCarthy
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org


___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-10 Thread Alexander Ladygin
in addition: even if i create new object instance for QNetworkAccessManager,
it still won't connect to internet, as if it still uses WiFi "globally"
even though wifi is off

On Tue, Nov 10, 2015 at 11:07 AM, Alexander Ladygin 
wrote:

> but how exactly can i make disconnect? All the network requests i send
> with QNetworkAccessManager after switching to mobile are returned with
> errors =(
>
> On Tue, Nov 10, 2015 at 4:05 AM, Aaron McCarthy 
> wrote:
>
>> On Tue, 10 Nov 2015 03:37:10 Alexander Ladygin wrote:
>> > I've got an issue: QNetworkAccessManager is losing connection upon
>> > switching between wifi and mobile:( What exactly should i do/update to
>> make
>> > it work properly? Maybe need to change network configuration? Why it is
>> not
>> > handled by platform?
>>
>> There is some support for migrating connections to the new interface. QNAM
>> supports resuming GET operations under the following conditions:
>>
>> 1. Only GET requests are resumed.
>> 2. No outgoing data.
>> 3. Server supports HTTP Accept-Ranges.
>> 4. Does not work with QNAM's zero-copy feature.
>> 5. Must be using bearer management.
>>
>> For other operations and GET requests that do not meet the above, you will
>> need to handle the network disconnection and resend the request.
>>
>> Cheers,
>>
>> --
>> Aaron McCarthy
>> ___
>> SailfishOS.org Devel mailing list
>> To unsubscribe, please send a mail to
>> devel-unsubscr...@lists.sailfishos.org
>>
>
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-10 Thread Alexander Ladygin
but how exactly can i make disconnect? All the network requests i send with
QNetworkAccessManager after switching to mobile are returned with errors =(

On Tue, Nov 10, 2015 at 4:05 AM, Aaron McCarthy 
wrote:

> On Tue, 10 Nov 2015 03:37:10 Alexander Ladygin wrote:
> > I've got an issue: QNetworkAccessManager is losing connection upon
> > switching between wifi and mobile:( What exactly should i do/update to
> make
> > it work properly? Maybe need to change network configuration? Why it is
> not
> > handled by platform?
>
> There is some support for migrating connections to the new interface. QNAM
> supports resuming GET operations under the following conditions:
>
> 1. Only GET requests are resumed.
> 2. No outgoing data.
> 3. Server supports HTTP Accept-Ranges.
> 4. Does not work with QNAM's zero-copy feature.
> 5. Must be using bearer management.
>
> For other operations and GET requests that do not meet the above, you will
> need to handle the network disconnection and resend the request.
>
> Cheers,
>
> --
> Aaron McCarthy
> ___
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscr...@lists.sailfishos.org
>
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Re: [SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-09 Thread Aaron McCarthy
On Tue, 10 Nov 2015 03:37:10 Alexander Ladygin wrote:
> I've got an issue: QNetworkAccessManager is losing connection upon
> switching between wifi and mobile:( What exactly should i do/update to make
> it work properly? Maybe need to change network configuration? Why it is not
> handled by platform?

There is some support for migrating connections to the new interface. QNAM 
supports resuming GET operations under the following conditions:

1. Only GET requests are resumed.
2. No outgoing data.
3. Server supports HTTP Accept-Ranges.
4. Does not work with QNAM's zero-copy feature.
5. Must be using bearer management.

For other operations and GET requests that do not meet the above, you will 
need to handle the network disconnection and resend the request.

Cheers,

-- 
Aaron McCarthy
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org


[SailfishDevel] QNetworkAccessManager is losing connection upon switching between wifi and mobile

2015-11-09 Thread Alexander Ladygin
Hey!

I've got an issue: QNetworkAccessManager is losing connection upon
switching between wifi and mobile:( What exactly should i do/update to make
it work properly? Maybe need to change network configuration? Why it is not
handled by platform?
Thanks.

Alex
___
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org