From 2d5cff9c0f1538462a4fddec8258f0966ec103cd Mon Sep 17 00:00:00 2001 From: jackdaw Date: Wed, 30 Nov 2016 16:12:28 +0900 Subject: [PATCH] remove result channel --- communicator.go | 13 +++++++++++++ events/event_port.go | 1 + 2 files changed, 14 insertions(+) diff --git a/communicator.go b/communicator.go index 8419ded..04b29ec 100644 --- a/communicator.go +++ b/communicator.go @@ -20,12 +20,25 @@ func (c *communicator) addEvent(e *events.Event) { c.Queue <- e } +// +//func CompressDataGzip(data []byte) []byte { +// var b bytes.Buffer +// w := gzip.NewWriter(&b) +// w.Write(data) +// w.Close() +// return b.Bytes() +//} + func (c *communicator) start() { go func() { for e := range c.Queue { go func(event *events.Event) { m := event.Data.(events.URLMaker) data, _ := json.Marshal(event) + + // compress , accept-encoding : gzip + + //res, err := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(CompressDataGzip(data))) res, err := http.Post(GetRootURL()+m.GetUrl(), "application/json", bytes.NewBuffer(data)) // todo timeout,error diff --git a/events/event_port.go b/events/event_port.go index d91a4e8..af3e466 100644 --- a/events/event_port.go +++ b/events/event_port.go @@ -17,6 +17,7 @@ func (i PortStartEvent) GetUrl() string { func NewPortStartEvent(zone int64, host int64, portCount uint16, t string) *PortStartEvent { return &PortStartEvent{ Zone: zone, + Host: host, PortCount: portCount, Type: t, }