aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-11-03 21:26:40 +0000
committerChristian Grothoff <christian@grothoff.org>2010-11-03 21:26:40 +0000
commit721e49caeea6ba5073f8bc5c6c08359295c02bb5 (patch)
treee06e80ba90af91e9452a48a7a5782913199b4877 /src/transport/plugin_transport_udp.c
parent37ac1b7c9e9e05f93d4100cfb53450ec2d370989 (diff)
downloadgnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.tar.gz
gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.zip
original patch from Mantis 1614
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 1f7aca59a..0f53719fe 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -471,7 +471,7 @@ struct Plugin
471 /** 471 /**
472 * The process id of the server process (if behind NAT) 472 * The process id of the server process (if behind NAT)
473 */ 473 */
474 pid_t server_pid; 474 GNUNET_OS_Process *server_proc;
475 475
476}; 476};
477 477
@@ -528,9 +528,11 @@ udp_transport_server_stop (void *cls)
528 } 528 }
529 if (plugin->behind_nat == GNUNET_YES) 529 if (plugin->behind_nat == GNUNET_YES)
530 { 530 {
531 if (0 != PLIBC_KILL (plugin->server_pid, SIGTERM)) 531 if (0 != GNUNET_OS_process_kill (plugin->server_proc, SIGTERM))
532 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 532 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
533 GNUNET_OS_process_wait (plugin->server_pid); 533 GNUNET_OS_process_wait (plugin->server_proc);
534 GNUNET_OS_process_close (plugin->server_proc);
535 plugin->server_proc = NULL;
534 } 536 }
535 return GNUNET_OK; 537 return GNUNET_OK;
536} 538}
@@ -700,7 +702,7 @@ run_gnunet_nat_client (struct Plugin *plugin, const char *addr, size_t addrlen)
700 char addr_buf[INET_ADDRSTRLEN]; 702 char addr_buf[INET_ADDRSTRLEN];
701 char *address_as_string; 703 char *address_as_string;
702 char *port_as_string; 704 char *port_as_string;
703 pid_t pid; 705 GNUNET_OS_Process *proc;
704 const struct IPv4UdpAddress *t4; 706 const struct IPv4UdpAddress *t4;
705 707
706 GNUNET_assert(addrlen == sizeof(struct IPv4UdpAddress)); 708 GNUNET_assert(addrlen == sizeof(struct IPv4UdpAddress));
@@ -721,10 +723,12 @@ run_gnunet_nat_client (struct Plugin *plugin, const char *addr, size_t addrlen)
721#endif 723#endif
722 724
723 /* Start the server process */ 725 /* Start the server process */
724 pid = GNUNET_OS_start_process(NULL, NULL, "gnunet-nat-client", "gnunet-nat-client", plugin->external_address, address_as_string, port_as_string, NULL); 726 proc = GNUNET_OS_start_process(NULL, NULL, "gnunet-nat-client", "gnunet-nat-client", plugin->external_address, address_as_string, port_as_string, NULL);
725 GNUNET_free(address_as_string); 727 GNUNET_free(address_as_string);
726 GNUNET_free(port_as_string); 728 GNUNET_free(port_as_string);
727 GNUNET_OS_process_wait (pid); 729 GNUNET_OS_process_wait (proc);
730 GNUNET_OS_process_close (proc);
731 proc = NULL;
728} 732}
729 733
730/** 734/**
@@ -1637,12 +1641,12 @@ udp_transport_server_start (void *cls)
1637 plugin->internal_address); 1641 plugin->internal_address);
1638#endif 1642#endif
1639 /* Start the server process */ 1643 /* Start the server process */
1640 plugin->server_pid = GNUNET_OS_start_process(NULL, 1644 plugin->server_proc = GNUNET_OS_start_process(NULL,
1641 plugin->server_stdout, 1645 plugin->server_stdout,
1642 "gnunet-nat-server", 1646 "gnunet-nat-server",
1643 "gnunet-nat-server", 1647 "gnunet-nat-server",
1644 plugin->internal_address, NULL); 1648 plugin->internal_address, NULL);
1645 if (plugin->server_pid == GNUNET_SYSERR) 1649 if (plugin->server_proc == NULL)
1646 { 1650 {
1647#if DEBUG_UDP 1651#if DEBUG_UDP
1648 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1652 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,