From 4e8feaf569e6ca2bcd23167eaec2f4805a8ab41b Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 7 Aug 2018 17:21:20 -0700 Subject: Handle DpiBye --- ipfs.dpi.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ipfs.dpi.go') diff --git a/ipfs.dpi.go b/ipfs.dpi.go index 85ce02e..1c4b443 100644 --- a/ipfs.dpi.go +++ b/ipfs.dpi.go @@ -63,6 +63,7 @@ func handleTag(conn net.Conn, reader *bufio.Reader) error { switch cmd { case "auth": return handleAuth(conn, tag.Props["msg"]) case "open_url": return handleOpenUrl(conn, tag.Props["url"]) + case "DpiBye": return handleDpiBye(conn) default: return fmt.Errorf("unhandled cmd \"%s\"\n", cmd) } } @@ -102,6 +103,12 @@ func handleOpenUrl(conn net.Conn, url_str string) error { } } +func handleDpiBye(conn net.Conn) error { + fmt.Fprintf(os.Stderr, "[ipfs dpi]: Stopping\n") + os.Exit(0) + return nil +} + func escapeDpiValue(str string) string { return strings.Replace(str, "'", "''", -1) } @@ -261,7 +268,3 @@ func readProperty(reader *bufio.Reader) (string, string, error) { return string(key_bytes), string(value_bytes), nil } - -// -// aasd' '> - -- cgit v1.2.3