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>
This commit is contained in:
parent
953e36b6aa
commit
29fc59e535
4 changed files with 3 additions and 7 deletions
|
@ -151,7 +151,6 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
|
||||||
rc = net_send(nbuf);
|
rc = net_send(nbuf);
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
ip_buf_unref(nbuf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
@ -168,7 +167,7 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
return 0;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
|
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
|
||||||
|
|
|
@ -68,7 +68,6 @@ int tcp_tx(void *context, const unsigned char *buf, size_t size)
|
||||||
rc = net_send(nbuf);
|
rc = net_send(nbuf);
|
||||||
fiber_sleep(TCP_RETRY_TIMEOUT);
|
fiber_sleep(TCP_RETRY_TIMEOUT);
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
ip_buf_unref(nbuf);
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
|
|
@ -152,7 +152,6 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
|
||||||
rc = net_send(nbuf);
|
rc = net_send(nbuf);
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
ip_buf_unref(nbuf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
@ -169,7 +168,7 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
return 0;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
|
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
|
||||||
|
|
|
@ -152,7 +152,6 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
|
||||||
rc = net_send(nbuf);
|
rc = net_send(nbuf);
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
ip_buf_unref(nbuf);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
@ -169,7 +168,7 @@ static int tcp_tx(struct net_context *ctx, uint8_t *buf, size_t size,
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
return 0;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
|
static int tcp_rx(struct net_context *ctx, uint8_t *buf, size_t *read_bytes,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue