Fixed newly-introduced compile-breaking bugs in the network code.

This commit is contained in:
OBattler
2019-11-14 21:22:54 +01:00
parent aed984c265
commit 841a1f67da
4 changed files with 20 additions and 6 deletions

View File

@@ -185,7 +185,7 @@ poll_thread(void *arg)
if (pcap == NULL) break;
/* Wait for the next packet to arrive. */
if (network_wait)
if (network_get_wait())
data = NULL;
else
data = (uint8_t *)f_pcap_next((void *)pcap, &h);

View File

@@ -148,7 +148,7 @@ poll_thread(void *arg)
/* Wait for the next packet to arrive. */
data_valid = 0;
if (!network_wait && (QueuePeek(slirpq) != 0)) {
if (!network_get_wait() && (QueuePeek(slirpq) != 0)) {
/* Grab a packet from the queue. */
// ui_sb_update_icon(SB_NETWORK, 1);

View File

@@ -99,7 +99,7 @@ static netcard_t net_cards[] = {
int network_type;
int network_ndev;
int network_card;
volatile int network_wait = 0;
static volatile int net_wait = 0;
char network_host[522];
netdev_t network_devs[32];
#ifdef ENABLE_NIC_LOG
@@ -221,7 +221,7 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx)
net_cards[network_card].rx = rx;
network_mac = mac;
network_wait = 0;
network_set_wait(0);
/* Create the network events. */
poll_data.wake_poll_thread = thread_create_event();
@@ -450,5 +450,19 @@ network_card_get_from_internal_name(char *s)
void
network_set_wait(int wait)
{
network_wait = wait;
network_wait(1);
net_wait = wait;
network_wait(0);
}
int
network_get_wait(void)
{
int ret;
network_wait(1);
ret = net_wait;
network_wait(0);
return ret;
}

View File

@@ -89,7 +89,6 @@ extern "C" {
/* Global variables. */
extern int nic_do_log; /* config */
extern int network_ndev;
extern volatile int network_wait;
extern netdev_t network_devs[32];
@@ -126,6 +125,7 @@ extern int network_card_get_from_internal_name(char *);
extern const device_t *network_card_getdevice(int);
extern void network_set_wait(int wait);
extern int network_get_wait(void);
#ifdef __cplusplus
}