summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Santes <flavio.santes@intel.com>2016-08-17 14:33:19 -0500
committerAndrew Boie <andrew.p.boie@intel.com>2016-08-18 16:08:11 +0000
commit29fc59e535aebd49e26a3296356914e4c6abfb82 (patch)
tree267700bcdaa32412ae6c6b9d92c4b29b7d909ade
parent953e36b6aab5448422edd80122eb8ec3178a25aa (diff)
samples/net: Remove call to unref routine when net_send returns >= 0
According to last comments posted in ZEP-632, the unref routine must be called only when net_send reports an error. Jira: ZEP-632 Change-Id: I11553edf2c7d686c3e58617c2e05b6f18962955e Signed-off-by: Flavio Santes <flavio.santes@intel.com>
-rw-r--r--samples/net/dns_client/src/netz.c3
-rw-r--r--samples/net/mbedtls_sslclient/src/tcp.c1
-rw-r--r--samples/net/nats_clients/publisher/src/netz.c3
-rw-r--r--samples/net/paho_mqtt_clients/publisher/src/netz.c3
4 files changed, 3 insertions, 7 deletions
diff --git a/samples/net/dns_client/src/netz.c b/samples/net/dns_client/src/netz.c
index b57932b22..b555fa85e 100644
--- a/samples/net/dns_client/src/netz.c
+++ b/samples/net/dns_client/src/netz.c
@@ -151,7 +151,6 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
rc = net_send(nbuf);
if (rc >= 0) {
- ip_buf_unref(nbuf);
return 0;
}
switch (rc) {
@@ -168,7 +167,7 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
}
} while (1);
- return 0;
+ return -EIO;
}
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
diff --git a/samples/net/mbedtls_sslclient/src/tcp.c b/samples/net/mbedtls_sslclient/src/tcp.c
index b5314ef53..4aeaf418d 100644
--- a/samples/net/mbedtls_sslclient/src/tcp.c
+++ b/samples/net/mbedtls_sslclient/src/tcp.c
@@ -68,7 +68,6 @@ int tcp_tx(void *context, const unsigned char *buf, size_t size)
rc = net_send(nbuf);
fiber_sleep(TCP_RETRY_TIMEOUT);
if (rc >= 0) {
- ip_buf_unref(nbuf);
return size;
}
switch (rc) {
diff --git a/samples/net/nats_clients/publisher/src/netz.c b/samples/net/nats_clients/publisher/src/netz.c
index aa9df1eb6..ea15dcd90 100644
--- a/samples/net/nats_clients/publisher/src/netz.c
+++ b/samples/net/nats_clients/publisher/src/netz.c
@@ -152,7 +152,6 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
rc = net_send(nbuf);
if (rc >= 0) {
- ip_buf_unref(nbuf);
return 0;
}
switch (rc) {
@@ -169,7 +168,7 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
}
} while (1);
- return 0;
+ return -EIO;
}
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
diff --git a/samples/net/paho_mqtt_clients/publisher/src/netz.c b/samples/net/paho_mqtt_clients/publisher/src/netz.c
index 8d59276a1..6b916b338 100644
--- a/samples/net/paho_mqtt_clients/publisher/src/netz.c
+++ b/samples/net/paho_mqtt_clients/publisher/src/netz.c
@@ -152,7 +152,6 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
rc = net_send(nbuf);
if (rc >= 0) {
- ip_buf_unref(nbuf);
return 0;
}
switch (rc) {
@@ -169,7 +168,7 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
}
} while (1);
- return 0;
+ return -EIO;
}
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,