Added the ability to pause and resume the network thread's reception.
This commit is contained in:
@@ -8,11 +8,11 @@
|
||||
*
|
||||
* Handle WinPcap library processing.
|
||||
*
|
||||
* Version: @(#)net_pcap.c 1.0.9 2018/10/19
|
||||
* Version: @(#)net_pcap.c 1.0.10 2019/11/14
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
@@ -185,7 +185,10 @@ poll_thread(void *arg)
|
||||
if (pcap == NULL) break;
|
||||
|
||||
/* Wait for the next packet to arrive. */
|
||||
data = (uint8_t *)f_pcap_next((void *)pcap, &h);
|
||||
if (network_wait)
|
||||
data = NULL;
|
||||
else
|
||||
data = (uint8_t *)f_pcap_next((void *)pcap, &h);
|
||||
if (data != NULL) {
|
||||
// ui_sb_update_icon(SB_NETWORK, 1);
|
||||
|
||||
|
@@ -8,11 +8,11 @@
|
||||
*
|
||||
* Handle SLiRP library processing.
|
||||
*
|
||||
* Version: @(#)net_slirp.c 1.0.8 2018/10/19
|
||||
* Version: @(#)net_slirp.c 1.0.9 2019/11/14
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
@@ -148,7 +148,7 @@ poll_thread(void *arg)
|
||||
/* Wait for the next packet to arrive. */
|
||||
data_valid = 0;
|
||||
|
||||
if (QueuePeek(slirpq) != 0) {
|
||||
if (!network_wait && (QueuePeek(slirpq) != 0)) {
|
||||
/* Grab a packet from the queue. */
|
||||
// ui_sb_update_icon(SB_NETWORK, 1);
|
||||
|
||||
|
@@ -12,11 +12,11 @@
|
||||
* it should be malloc'ed and then linked to the NETCARD def.
|
||||
* Will be done later.
|
||||
*
|
||||
* Version: @(#)network.c 1.0.10 2018/11/18
|
||||
* Version: @(#)network.c 1.0.11 2019/11/14
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
@@ -99,6 +99,7 @@ static netcard_t net_cards[] = {
|
||||
int network_type;
|
||||
int network_ndev;
|
||||
int network_card;
|
||||
volatile int network_wait;
|
||||
char network_host[522];
|
||||
netdev_t network_devs[32];
|
||||
#ifdef ENABLE_NIC_LOG
|
||||
@@ -442,3 +443,10 @@ network_card_get_from_internal_name(char *s)
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
network_set_wait(int wait)
|
||||
{
|
||||
network_wait = wait;
|
||||
}
|
||||
|
@@ -8,11 +8,11 @@
|
||||
*
|
||||
* Definitions for the network module.
|
||||
*
|
||||
* Version: @(#)network.h 1.0.2 2018/03/15
|
||||
* Version: @(#)network.h 1.0.3 2019/11/14
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
@@ -89,6 +89,7 @@ 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];
|
||||
|
||||
|
||||
@@ -124,6 +125,8 @@ extern char *network_card_get_internal_name(int);
|
||||
extern int network_card_get_from_internal_name(char *);
|
||||
extern const device_t *network_card_getdevice(int);
|
||||
|
||||
extern void network_set_wait(int wait);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user