You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by rb...@apache.org on 2020/04/30 19:28:08 UTC
[celix] branch bugfix/fix_tcp_admin_using_ip_with_postfix created
(now 09635b6)
This is an automated email from the ASF dual-hosted git repository.
rbulter pushed a change to branch bugfix/fix_tcp_admin_using_ip_with_postfix
in repository https://gitbox.apache.org/repos/asf/celix.git.
at 09635b6 Merge branch 'develop' into bugfix/fix_tcp_admin_using_ip_with_postfix
This branch includes the following new commits:
new 79bc4dd Fix crash in pub using ip with post fix
new 09635b6 Merge branch 'develop' into bugfix/fix_tcp_admin_using_ip_with_postfix
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[celix] 02/02: Merge branch 'develop' into
bugfix/fix_tcp_admin_using_ip_with_postfix
Posted by rb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rbulter pushed a commit to branch bugfix/fix_tcp_admin_using_ip_with_postfix
in repository https://gitbox.apache.org/repos/asf/celix.git
commit 09635b622632f284810ff9c2d5c60c5a47bb5988
Merge: 79bc4dd ce67452
Author: Roy Bulter <ro...@gmail.com>
AuthorDate: Thu Apr 30 21:27:21 2020 +0200
Merge branch 'develop' into bugfix/fix_tcp_admin_using_ip_with_postfix
.../pubsub_admin_tcp/src/pubsub_tcp_handler.c | 43 ++++++++++++++--------
.../src/pubsub_tcp_topic_receiver.c | 7 ++--
libs/framework/src/framework.c | 5 +++
libs/utils/private/test/celix_threads_test.cpp | 1 +
libs/utils/src/utils.c | 4 +-
5 files changed, 41 insertions(+), 19 deletions(-)
[celix] 01/02: Fix crash in pub using ip with post fix
Posted by rb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rbulter pushed a commit to branch bugfix/fix_tcp_admin_using_ip_with_postfix
in repository https://gitbox.apache.org/repos/asf/celix.git
commit 79bc4ddc308f3bfdb3ac2d99183bbb91b1c844b9
Author: Roy Bulter <ro...@gmail.com>
AuthorDate: Thu Apr 30 21:26:01 2020 +0200
Fix crash in pub using ip with post fix
---
.../pubsub_admin_tcp/src/pubsub_tcp_handler.c | 81 +++++++++++-----------
bundles/pubsub/pubsub_utils/src/pubsub_utils_url.c | 2 +-
2 files changed, 43 insertions(+), 40 deletions(-)
diff --git a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
index 5144e01..cb4d2b2 100644
--- a/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
+++ b/bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
@@ -574,52 +574,55 @@ int pubsub_tcpHandler_listen(pubsub_tcpHandler_t *handle, char *url) {
// Make handler fd entry
char *pUrl = pubsub_utils_url_get_url(sin, protocol);
entry = pubsub_tcpHandler_createEntry(handle, fd, pUrl, NULL, sin);
- entry->connected = true;
- free(pUrl);
- free(sin);
- celixThreadRwlock_writeLock(&handle->dbLock);
- rc = fd;
- if (rc >= 0) {
- rc = listen(fd, SOMAXCONN);
- if (rc != 0) {
- L_ERROR("[TCP Socket] Error listen: %s\n", strerror(errno));
- pubsub_tcpHandler_freeEntry(entry);
- entry = NULL;
+ if (entry != NULL) {
+ entry->connected = true;
+ free(pUrl);
+ free(sin);
+ celixThreadRwlock_writeLock(&handle->dbLock);
+ rc = fd;
+ if (rc >= 0) {
+ rc = listen(fd, SOMAXCONN);
+ if (rc != 0) {
+ L_ERROR("[TCP Socket] Error listen: %s\n", strerror(errno));
+ pubsub_tcpHandler_freeEntry(entry);
+ entry = NULL;
+ }
}
- }
- if (rc >= 0) {
- rc = pubsub_tcpHandler_makeNonBlocking(handle, fd);
- if (rc < 0) {
- pubsub_tcpHandler_freeEntry(entry);
- entry = NULL;
+ if (rc >= 0) {
+ rc = pubsub_tcpHandler_makeNonBlocking(handle, fd);
+ if (rc < 0) {
+ pubsub_tcpHandler_freeEntry(entry);
+ entry = NULL;
+ }
}
- }
- if ((rc >= 0) && (handle->efd >= 0)) {
+ if ((rc >= 0) && (handle->efd >= 0)) {
#if defined(__APPLE__)
- struct kevent ev;
- EV_SET (&ev, fd, EVFILT_READ, EV_ADD | EV_ENABLE , 0, 0, 0);
- rc = kevent (handle->efd, &ev, 1, NULL, 0, NULL);
+ struct kevent ev;
+ EV_SET (&ev, fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0);
+ rc = kevent(handle->efd, &ev, 1, NULL, 0, NULL);
#else
- struct epoll_event event;
- bzero(&event, sizeof(event)); // zero the struct
- event.events = EPOLLIN | EPOLLRDHUP | EPOLLERR;
- event.data.fd = fd;
- rc = epoll_ctl(handle->efd, EPOLL_CTL_ADD, fd, &event);
+ struct epoll_event event;
+ bzero(&event, sizeof(event)); // zero the struct
+ event.events = EPOLLIN | EPOLLRDHUP | EPOLLERR;
+ event.data.fd = fd;
+ rc = epoll_ctl(handle->efd, EPOLL_CTL_ADD, fd, &event);
#endif
- if (rc < 0) {
- L_ERROR("[TCP Socket] Cannot create poll: %s\n", strerror(errno));
- errno = 0;
- pubsub_tcpHandler_freeEntry(entry);
- entry = NULL;
+ if (rc < 0) {
+ L_ERROR("[TCP Socket] Cannot create poll: %s\n", strerror(errno));
+ errno = 0;
+ pubsub_tcpHandler_freeEntry(entry);
+ entry = NULL;
+ }
+ if (entry) {
+ L_INFO("[TCP Socket] Using %s for service annunciation", entry->url);
+ hashMap_put(handle->interface_fd_map, (void *) (intptr_t) entry->fd, entry);
+ hashMap_put(handle->interface_url_map, entry->url, entry);
+ }
}
- if (entry)
- L_INFO("[TCP Socket] Using %s for service annunciation", entry->url);
- if (entry)
- hashMap_put(handle->interface_fd_map, (void *) (intptr_t) entry->fd, entry);
- if (entry)
- hashMap_put(handle->interface_url_map, entry->url, entry);
+ celixThreadRwlock_unlock(&handle->dbLock);
+ } else {
+ L_ERROR("[TCP Socket] Error listen socket cannot bind to %s: %s\n", url ? url : "", strerror(errno));
}
- celixThreadRwlock_unlock(&handle->dbLock);
}
return rc;
}
diff --git a/bundles/pubsub/pubsub_utils/src/pubsub_utils_url.c b/bundles/pubsub/pubsub_utils/src/pubsub_utils_url.c
index 2ac9cfa..d8d518c 100644
--- a/bundles/pubsub/pubsub_utils/src/pubsub_utils_url.c
+++ b/bundles/pubsub/pubsub_utils/src/pubsub_utils_url.c
@@ -161,7 +161,7 @@ char *pubsub_utils_url_get_ip(char *_hostname) {
if (subNet != NULL) {
unsigned int length = strlen(subNet);
if ((length > 1) && isdigit(subNet[1])) {
- bool is_multicast = pubsub_utils_url_is_multicast(_hostname);
+ bool is_multicast = pubsub_utils_url_is_multicast(hostname);
if (is_multicast)
ip = pubsub_utils_url_get_multicast_ip(_hostname);
else