remove result channel

This commit is contained in:
jackdaw 2016-11-30 16:12:28 +09:00
parent 6cc0ec1ee0
commit 2d5cff9c0f
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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,
}