[Tarantool-patches] [PATCH 1/2] swim: add SO_BROADCAST option

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Mar 19 02:18:46 MSK 2021


I force updated the patch on the branch.

Could you please check if it works on your machine? For
example, this test:

	uuid = require('uuid')
	swim = require('swim')

	s = swim.new({uuid = uuid(), uri = '127.0.0.1:3313'})

	s:broadcast(3313)

On Mac it used to print EADDRNOTAVAIL message. Probably
would fail with something on Linux too, but I don't know.
Might just work fine as well.

====================
diff --git a/src/lib/swim/swim_io.c b/src/lib/swim/swim_io.c
index 45df36ba4..c3fca3d7f 100644
--- a/src/lib/swim/swim_io.c
+++ b/src/lib/swim/swim_io.c
@@ -513,7 +513,7 @@ swim_complete_send(struct swim_scheduler *scheduler, struct swim_task *task,
 		   ssize_t size)
 {
 	if (size < 0) {
-		bool is_critical = false;
+		bool is_critical = true;
 #if TARGET_OS_DARWIN
 		/*
 		 * On Mac this error happens regularly if SWIM is bound to
@@ -524,7 +524,7 @@ swim_complete_send(struct swim_scheduler *scheduler, struct swim_task *task,
 		 * is not supposed to be used in prod.
 		 */
 		struct error *last = diag_last_error(diag_get());
-		is_critical = (last->saved_errno == EADDRNOTAVAIL);
+		is_critical = (last->saved_errno != EADDRNOTAVAIL);
 #endif
 		if (is_critical)
 			diag_log();


More information about the Tarantool-patches mailing list