mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-14 07:40:07 +02:00
236 lines
6.8 KiB
Plaintext
236 lines
6.8 KiB
Plaintext
From 7d4e32d4fc3a5a4bdd2a627e95484ff0ee53bbd6 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Tue, 20 May 2014 16:30:21 +0000
|
|
Subject: haiku patch
|
|
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 0633284..ac241fa 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -151,7 +151,7 @@ else
|
|
fi
|
|
|
|
# Checks for libraries.
|
|
-AC_SEARCH_LIBS([recvfrom], [socket])
|
|
+AC_SEARCH_LIBS([recvfrom], [socket network])
|
|
AC_CHECK_FUNC([log], [], [AC_CHECK_LIB([m],[log])])
|
|
AC_CHECK_FUNCS([getifaddrs])
|
|
|
|
--
|
|
2.13.1
|
|
|
|
|
|
From 55c690cde0588db2c5c1d1d861bb541c50c8e57e Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Tue, 20 May 2014 16:51:04 +0000
|
|
Subject: check getifaddrs
|
|
|
|
|
|
diff --git a/lo/lo_cpp.h b/lo/lo_cpp.h
|
|
index c2141b0..058171a 100644
|
|
--- a/lo/lo_cpp.h
|
|
+++ b/lo/lo_cpp.h
|
|
@@ -227,11 +227,19 @@ namespace lo {
|
|
std::string url() const
|
|
{ auto s(lo_address_get_url(address)); return std::string(s?s:""); }
|
|
|
|
+#ifdef HAVE_GETIFADDRS
|
|
std::string iface() const
|
|
{ auto s(lo_address_get_iface(address)); return std::string(s?s:""); }
|
|
|
|
void set_iface(const string_type &iface, const string_type &ip)
|
|
{ lo_address_set_iface(address, iface, ip); }
|
|
+#else
|
|
+ std::string iface() const
|
|
+ { return std::string(""); }
|
|
+
|
|
+ void set_iface(const string_type &iface, const string_type &ip)
|
|
+ { }
|
|
+#endif
|
|
|
|
int set_tcp_nodelay(int enable)
|
|
{ return lo_address_set_tcp_nodelay(address, enable); }
|
|
--
|
|
2.13.1
|
|
|
|
|
|
From 9e432508abf5c6c4886a541b3a4ae4049602e507 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Tue, 20 May 2014 22:09:52 +0000
|
|
Subject: gcc2 build fix
|
|
|
|
|
|
diff --git a/examples/example_tcp_echo_server.c b/examples/example_tcp_echo_server.c
|
|
index 11ff1b9..9b09bb9 100644
|
|
--- a/examples/example_tcp_echo_server.c
|
|
+++ b/examples/example_tcp_echo_server.c
|
|
@@ -48,6 +48,9 @@ void ctrlc(int sig)
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
+ lo_server_thread st;
|
|
+ lo_server s;
|
|
+ lo_address a = 0;
|
|
const char *port = "7770";
|
|
int do_send = 0;
|
|
|
|
@@ -57,13 +60,13 @@ int main(int argc, char *argv[])
|
|
}
|
|
|
|
/* start a new server on port 7770 */
|
|
- lo_server_thread st = lo_server_thread_new_with_proto(port, LO_TCP, error);
|
|
+ st = lo_server_thread_new_with_proto(port, LO_TCP, error);
|
|
if (!st) {
|
|
printf("Could not create server thread.\n");
|
|
exit(1);
|
|
}
|
|
|
|
- lo_server s = lo_server_thread_get_server(st);
|
|
+ s = lo_server_thread_get_server(st);
|
|
|
|
/* add method that will match the path /quit with no args */
|
|
lo_server_thread_add_method(st, "/quit", "", quit_handler, NULL);
|
|
@@ -77,14 +80,14 @@ int main(int argc, char *argv[])
|
|
|
|
printf("Listening on TCP port %s\n", port);
|
|
|
|
- lo_address a = 0;
|
|
if (do_send) {
|
|
+ int r;
|
|
a = lo_address_new_with_proto(LO_TCP, "localhost", "7770");
|
|
if (!a) {
|
|
printf("Error creating destination address.\n");
|
|
exit(1);
|
|
}
|
|
- int r = lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", "ifs",
|
|
+ r = lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", "ifs",
|
|
1, 2.0f, "3");
|
|
if (r < 0)
|
|
printf("Error sending initial message.\n");
|
|
@@ -117,6 +120,7 @@ int echo_handler(const char *path, const char *types, lo_arg ** argv,
|
|
int argc, void *data, void *user_data)
|
|
{
|
|
int i;
|
|
+ int r;
|
|
lo_message m = (lo_message)data;
|
|
lo_address a = lo_message_get_source(m);
|
|
lo_server s = (lo_server)user_data;
|
|
@@ -144,7 +148,7 @@ int echo_handler(const char *path, const char *types, lo_arg ** argv,
|
|
return 0;
|
|
}
|
|
|
|
- int r = lo_send_message_from(a, s, path, m);
|
|
+ r = lo_send_message_from(a, s, path, m);
|
|
if (r < 0)
|
|
printf("Error sending back message, socket may have closed.\n");
|
|
else
|
|
diff --git a/src/address.c b/src/address.c
|
|
index 8b50fdd..0018db9 100644
|
|
--- a/src/address.c
|
|
+++ b/src/address.c
|
|
@@ -627,6 +627,9 @@ int lo_inaddr_find_iface(lo_inaddr t, int fam,
|
|
PIP_ADAPTER_ADDRESSES paa, aa;
|
|
DWORD rc;
|
|
int found;
|
|
+#else
|
|
+ struct ifaddrs *ifa, *ifa_list;
|
|
+ int found = 0;
|
|
#endif
|
|
|
|
union {
|
|
@@ -745,12 +748,10 @@ int lo_inaddr_find_iface(lo_inaddr t, int fam,
|
|
|
|
#else // !WIN32
|
|
|
|
- struct ifaddrs *ifa, *ifa_list;
|
|
if (getifaddrs(&ifa_list)==-1)
|
|
return 5;
|
|
ifa = ifa_list;
|
|
|
|
- int found = 0;
|
|
while (ifa) {
|
|
if (!ifa->ifa_addr) {
|
|
ifa = ifa->ifa_next;
|
|
diff --git a/src/message.c b/src/message.c
|
|
index 0813587..eeb43cb 100644
|
|
--- a/src/message.c
|
|
+++ b/src/message.c
|
|
@@ -259,6 +259,7 @@ int lo_message_add_varargs_internal(lo_message msg, const char *types,
|
|
}
|
|
}
|
|
#ifndef USE_ANSI_C
|
|
+{
|
|
void *i = va_arg(ap, void *);
|
|
if (((UINT_PTR)i & 0xFFFFFFFFUL)
|
|
!= ((UINT_PTR)LO_MARKER_A & 0xFFFFFFFFUL))
|
|
@@ -281,6 +282,7 @@ int lo_message_add_varargs_internal(lo_message msg, const char *types,
|
|
"mismatching types and data at\n%s:%d, exiting.\n", file,
|
|
line);
|
|
}
|
|
+}
|
|
#endif
|
|
va_end(ap);
|
|
|
|
diff --git a/src/server.c b/src/server.c
|
|
index 01fa08f..f86a3cd 100644
|
|
--- a/src/server.c
|
|
+++ b/src/server.c
|
|
@@ -1319,6 +1319,7 @@ int lo_server_wait(lo_server s, int timeout)
|
|
{
|
|
if (s->protocol == LO_TCP)
|
|
{
|
|
+ double diff;
|
|
int sock = accept(s->sockets[0].fd,
|
|
(struct sockaddr *) &addr, &addr_len);
|
|
|
|
@@ -1330,7 +1331,7 @@ int lo_server_wait(lo_server s, int timeout)
|
|
|
|
lo_timetag_now(&now);
|
|
|
|
- double diff = lo_timetag_diff(now, then);
|
|
+ diff = lo_timetag_diff(now, then);
|
|
|
|
sched_timeout = lo_server_next_event_delay(s) * 1000;
|
|
timeout -= (int)(diff*1000);
|
|
diff --git a/src/test_bidirectional_tcp.c b/src/test_bidirectional_tcp.c
|
|
index 9292a0b..d49aa1c 100644
|
|
--- a/src/test_bidirectional_tcp.c
|
|
+++ b/src/test_bidirectional_tcp.c
|
|
@@ -34,6 +34,7 @@ unsigned sendthread(void *arg)
|
|
void *sendthread(void *arg)
|
|
#endif
|
|
{
|
|
+ lo_address a;
|
|
lo_server s = lo_server_new_with_proto("7772", LO_TCP, 0);
|
|
if (!s) { printf("no server2\n"); exit(1); }
|
|
|
|
@@ -41,7 +42,7 @@ void *sendthread(void *arg)
|
|
|
|
lo_server_add_method(s, 0, 0, generic_handler, s);
|
|
|
|
- lo_address a = lo_address_new_with_proto(LO_TCP, "localhost", "7771");
|
|
+ a = lo_address_new_with_proto(LO_TCP, "localhost", "7771");
|
|
|
|
lo_send_from(a, s, LO_TT_IMMEDIATE, "/test", 0);
|
|
|
|
@@ -61,6 +62,7 @@ void *sendthread(void *arg)
|
|
|
|
int main()
|
|
{
|
|
+ pthread_t thr;
|
|
/* start a new server on port 7770 */
|
|
lo_server s = lo_server_new_with_proto("7771", LO_TCP, 0);
|
|
if (!s) { printf("no server\n"); exit(1); }
|
|
@@ -73,7 +75,6 @@ int main()
|
|
#ifdef HAVE_WIN32_THREADS
|
|
HANDLE thr = (HANDLE)_beginthreadex(NULL, 0, &sendthread, s, 0, NULL);
|
|
#else
|
|
- pthread_t thr;
|
|
pthread_create(&thr, 0, sendthread, s);
|
|
#endif
|
|
|
|
--
|
|
2.13.1
|
|
|