Commit f27f7319 authored by Aurelio Colosimo's avatar Aurelio Colosimo

state-initializing: removed pp_did_init static var and put into pp_instance

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent d374d174
......@@ -156,6 +156,7 @@ struct pp_net_path {
Integer32 mcast_addr;
Integer32 peer_mcast_addr;
int proto_ofst;
int inited;
};
#define PROTO_HDR(x) ( (x) - NP(ppi)->proto_ofst);
#define PROTO_PAYLOAD(x) ( (x) + NP(ppi)->proto_ofst);
......
......@@ -13,7 +13,6 @@
/*
* Initializes network and other stuff
*/
static int pp_did_init = 0;
#define LOCK_TIMEOUT_GM (60000)
......@@ -21,12 +20,14 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
unsigned char *id, *mac;
if (pp_did_init)
if (NP(ppi)->inited)
pp_net_shutdown(ppi);
if (pp_net_init(ppi) < 0)
goto failure;
pp_did_init = 1;
NP(ppi)->inited = 1;
DSPOR(ppi)->portState = PPS_INITIALIZING;
/* Initialize default data set */
......
......@@ -9,19 +9,20 @@
/*
* Initializes network and other stuff
*/
static int pp_did_init = 0;
int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
unsigned char *id, *mac;
if (pp_did_init)
if (NP(ppi)->inited)
pp_net_shutdown(ppi);
if (pp_net_init(ppi) < 0)
goto failure;
pp_did_init = 1;
NP(ppi)->inited = 1;
DSPOR(ppi)->portState = PPS_INITIALIZING;
/* Initialize default data set */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment