mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Merge pull request #4677 from GregorR/netplay-nat-traversal-task-3
Properly conditionalize NAT traversal task on HAVE_NETWORKING
This commit is contained in:
commit
c6d255ef63
@ -13,19 +13,22 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <lists/file_list.h>
|
#include <stdlib.h>
|
||||||
#include <string/stdstring.h>
|
|
||||||
|
|
||||||
#include "tasks_internal.h"
|
#include "tasks_internal.h"
|
||||||
#include "net/net_natt.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
|
#include <net/net_natt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../network/netplay/netplay.h"
|
#include "../network/netplay/netplay.h"
|
||||||
#include "../verbosity.h"
|
#include "../verbosity.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
struct nat_traversal_state_data
|
struct nat_traversal_state_data
|
||||||
{
|
{
|
||||||
struct natt_status *nat_traversal_state;
|
struct natt_status *nat_traversal_state;
|
||||||
@ -56,9 +59,11 @@ static void task_netplay_nat_traversal_handler(retro_task_t *task)
|
|||||||
task_set_progress(task, 100);
|
task_set_progress(task, 100);
|
||||||
task_set_finished(task, true);
|
task_set_finished(task, true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool task_push_netplay_nat_traversal(struct natt_status *nat_traversal_state, uint16_t port)
|
bool task_push_netplay_nat_traversal(void *nat_traversal_state, uint16_t port)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_NETWORKING
|
||||||
struct nat_traversal_state_data *ntsd;
|
struct nat_traversal_state_data *ntsd;
|
||||||
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
|
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
|
||||||
|
|
||||||
@ -73,7 +78,8 @@ bool task_push_netplay_nat_traversal(struct natt_status *nat_traversal_state, ui
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ntsd->nat_traversal_state = nat_traversal_state;
|
ntsd->nat_traversal_state =
|
||||||
|
(struct natt_status *) nat_traversal_state;
|
||||||
ntsd->port = port;
|
ntsd->port = port;
|
||||||
|
|
||||||
task->type = TASK_TYPE_BLOCKING;
|
task->type = TASK_TYPE_BLOCKING;
|
||||||
@ -84,4 +90,7 @@ bool task_push_netplay_nat_traversal(struct natt_status *nat_traversal_state, ui
|
|||||||
task_queue_ctl(TASK_QUEUE_CTL_PUSH, task);
|
task_queue_ctl(TASK_QUEUE_CTL_PUSH, task);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <queues/message_queue.h>
|
#include <queues/message_queue.h>
|
||||||
#include <queues/task_queue.h>
|
#include <queues/task_queue.h>
|
||||||
#include <formats/image.h>
|
#include <formats/image.h>
|
||||||
#include <net/net_natt.h>
|
|
||||||
|
|
||||||
#include "../content.h"
|
#include "../content.h"
|
||||||
#include "../core_type.h"
|
#include "../core_type.h"
|
||||||
@ -97,8 +96,7 @@ bool task_push_netplay_lan_scan(void);
|
|||||||
bool task_push_netplay_crc_scan(uint32_t crc, char* name,
|
bool task_push_netplay_crc_scan(uint32_t crc, char* name,
|
||||||
const char *hostname, const char *corename);
|
const char *hostname, const char *corename);
|
||||||
|
|
||||||
bool task_push_netplay_nat_traversal(struct natt_status *nat_traversal_state,
|
bool task_push_netplay_nat_traversal(void *nat_traversal_state, uint16_t port);
|
||||||
uint16_t port);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user