mirror of
https://github.com/dborth/vbagx.git
synced 2025-02-16 18:59:12 +01:00
update net code
This commit is contained in:
parent
e31668c42a
commit
1a88af2094
@ -173,7 +173,7 @@ bool DownloadUpdate()
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static lwp_t networkthread = LWP_THREAD_NULL;
|
static lwp_t networkthread = LWP_THREAD_NULL;
|
||||||
static u8 netstack[8192] ATTRIBUTE_ALIGN (32);
|
static u8 netstack[32768] ATTRIBUTE_ALIGN (32);
|
||||||
|
|
||||||
static void * netcb (void *arg)
|
static void * netcb (void *arg)
|
||||||
{
|
{
|
||||||
@ -197,6 +197,7 @@ static void * netcb (void *arg)
|
|||||||
res = net_get_status();
|
res = net_get_status();
|
||||||
if(res != -EBUSY) // trying to init net so we can't kill the net
|
if(res != -EBUSY) // trying to init net so we can't kill the net
|
||||||
{
|
{
|
||||||
|
usleep(2000);
|
||||||
net_wc24cleanup(); //kill the net
|
net_wc24cleanup(); //kill the net
|
||||||
reset=true;
|
reset=true;
|
||||||
break;
|
break;
|
||||||
@ -211,6 +212,7 @@ static void * netcb (void *arg)
|
|||||||
}
|
}
|
||||||
first=false;
|
first=false;
|
||||||
net_deinit();
|
net_deinit();
|
||||||
|
usleep(2000);
|
||||||
res = net_init_async(NULL, NULL);
|
res = net_init_async(NULL, NULL);
|
||||||
|
|
||||||
if(res != 0)
|
if(res != 0)
|
||||||
@ -221,7 +223,7 @@ static void * netcb (void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = net_get_status();
|
res = net_get_status();
|
||||||
wait = 400; // only wait 10 sec
|
wait = 400; // only wait 8 sec
|
||||||
while (res == -EBUSY && wait > 0 && (netHalt != 2))
|
while (res == -EBUSY && wait > 0 && (netHalt != 2))
|
||||||
{
|
{
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
@ -230,7 +232,6 @@ static void * netcb (void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(res==0) break;
|
if(res==0) break;
|
||||||
|
|
||||||
retry--;
|
retry--;
|
||||||
usleep(2000);
|
usleep(2000);
|
||||||
}
|
}
|
||||||
@ -271,12 +272,10 @@ void StartNetworkThread()
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void StopNetworkThread()
|
void StopNetworkThread()
|
||||||
{
|
{
|
||||||
if(networkthread == LWP_THREAD_NULL)
|
if(networkthread == LWP_THREAD_NULL || !LWP_ThreadIsSuspended(networkthread))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
netHalt = 2;
|
netHalt = 2;
|
||||||
|
|
||||||
if(LWP_ThreadIsSuspended(networkthread))
|
|
||||||
LWP_ResumeThread(networkthread);
|
LWP_ResumeThread(networkthread);
|
||||||
|
|
||||||
// wait for thread to finish
|
// wait for thread to finish
|
||||||
|
Loading…
x
Reference in New Issue
Block a user