Skip to content

Commit 136c4f1

Browse files
committed
uplink: do not automatically close uplink
The API implies that the caller is responsible for closing the uplink. Closing the uplink automatically `pouch_gateway_uplink_write()` is unintuitive and leads to the uplink being closed twice. Signed-off-by: Sam Friedman <sam@golioth.io>
1 parent 625b1b3 commit 136c4f1

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

include/pouch_gateway/uplink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ int pouch_gateway_uplink_write(struct pouch_gateway_uplink *uplink,
4444
/**
4545
* Open an uplink for the given downlink context.
4646
*
47+
* The uplink must be closed by a call to @ref pouch_gateway_uplink_close().
48+
*
4749
* @param downlink The downlink context.
4850
* @return Pointer to the uplink context.
4951
*/

lib/uplink.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,7 @@ int pouch_gateway_uplink_write(struct pouch_gateway_uplink *uplink,
210210
payload += bytes_to_copy;
211211
}
212212

213-
if (is_last)
214-
{
215-
pouch_gateway_uplink_close(uplink);
216-
}
217-
else
218-
{
219-
process_uplink(uplink);
220-
}
213+
process_uplink(uplink);
221214

222215
return 0;
223216
}

0 commit comments

Comments
 (0)