From 10d6f9e643d89748babd86a602954f30e16d3f95 Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Mon, 15 Aug 2022 23:50:26 +0800 Subject: [PATCH] close himitsu socket when done --- cmd/docker-credential-himitsu/erase.ha | 2 ++ cmd/docker-credential-himitsu/get.ha | 3 ++- cmd/docker-credential-himitsu/list.ha | 2 ++ cmd/docker-credential-himitsu/store.ha | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/docker-credential-himitsu/erase.ha b/cmd/docker-credential-himitsu/erase.ha index 1a9570a..cd36079 100644 --- a/cmd/docker-credential-himitsu/erase.ha +++ b/cmd/docker-credential-himitsu/erase.ha @@ -1,11 +1,13 @@ use bufio; use himitsu::client; use himitsu::query; +use net; use os; use strings; fn erase() void = { const hi = client::connect()!; + defer net::close(hi)!; const url = strings::fromutf8(bufio::scanline(os::stdin)! as []u8); const query = query::query { items = [ diff --git a/cmd/docker-credential-himitsu/get.ha b/cmd/docker-credential-himitsu/get.ha index e20f952..65e91fc 100644 --- a/cmd/docker-credential-himitsu/get.ha +++ b/cmd/docker-credential-himitsu/get.ha @@ -1,14 +1,15 @@ use bufio; use encoding::json; -use fmt; use himitsu::client; use himitsu::query; +use net; use os; use shlex; use strings; fn get() void = { const hi = client::connect()!; + defer net::close(hi)!; const url = strings::fromutf8(bufio::scanline(os::stdin)! as []u8); const query = query::query { items = [ diff --git a/cmd/docker-credential-himitsu/list.ha b/cmd/docker-credential-himitsu/list.ha index 6dc1a8b..8d74930 100644 --- a/cmd/docker-credential-himitsu/list.ha +++ b/cmd/docker-credential-himitsu/list.ha @@ -1,12 +1,14 @@ use encoding::json; use himitsu::client; use himitsu::query; +use net; use os; use shlex; use strings; fn list() void = { const hi = client::connect()!; + defer net::close(hi)!; const query = query::query { items = [ query::pair { key = "proto", value = "docker", private = false, optional = false}, diff --git a/cmd/docker-credential-himitsu/store.ha b/cmd/docker-credential-himitsu/store.ha index 2994f52..ebdf9e0 100644 --- a/cmd/docker-credential-himitsu/store.ha +++ b/cmd/docker-credential-himitsu/store.ha @@ -1,10 +1,12 @@ use encoding::json; use himitsu::client; use himitsu::query; +use net; use os; fn store() void = { const hi = client::connect()!; + defer net::close(hi)!; const json = json::load(os::stdin)! as json::object; defer json::finish(json); const url = *(json::get(&json, "ServerURL") as *json::value) as str; -- 2.45.2