From 53783387005ec8a67503d8ab7069b594e95f94f4 Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 3 May 2018 15:19:55 +0900 Subject: [PATCH] ing --- client/client.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/client.go b/client/client.go index b4ffc7d..02963b1 100644 --- a/client/client.go +++ b/client/client.go @@ -2,6 +2,7 @@ package client import ( "fmt" + "net/http" "net/url" "path" @@ -19,10 +20,10 @@ func NewConnector(containerType occp.ContainerType, portNumber int) (*csswc.Conn u.Path = path.Join(u.Path, occc.HTTPEntry_Container) connector := &csswc.Connectors{ - Name: containerType.String(), - URL: u.String(), + URL: u.String(), } + connector.Name = containerType.String() connector.ReconnectInterval = 5 connector.ReconnectTryTime = 2 connector.MaxMessageSize = 4096 @@ -32,6 +33,14 @@ func NewConnector(containerType occp.ContainerType, portNumber int) (*csswc.Conn connector.PingTimeout = 10 connector.PingPeriod = 9 + connector.RequestHeader = func() http.Header { + header := make(map[string][]string) + header[occc.HTTPRequestHeaderKey_Container_Method] = []string{occc.HTTPRequestHeaderValue_Container_Method_Connect} + header[occp.HTTPRequestHeaderKey_Container_Type] = []string{containerType.String()} + return header + } + connector.ResponseHandler = func(res *http.Response) { + } connector.OnDisconnected = func(connector csc.Connector) { logging.Logger().Debugf("Client[%s] has been disconnected", connector.GetName()) }