Skip to content

Commit

Permalink
More simplification and comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreachild committed Dec 17, 2024
1 parent d4d0247 commit 74b7f93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions gremlin-go/driver/httpProtocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ type httpProtocol struct {

serializer serializer
logHandler *logHandler
closed bool
}

// waits for response, deserializes and processes results
// function name is readLoop but is not actually a loop - just keeping the name due to the protocol interface for now
func (protocol *httpProtocol) readLoop(resultSets *synchronizedMap, errorCallback func()) {
msg, err := protocol.transporter.Read()

// Deserialize message and unpack.
// Deserialize response message
fmt.Println("Deserializing response")
resp, err := protocol.serializer.deserializeMessage(msg)
if err != nil {
Expand Down Expand Up @@ -67,11 +67,11 @@ func newHttpProtocol(handler *logHandler, url string, connSettings *connectionSe
protocolBase: &protocolBase{transporter: transport},
serializer: newGraphBinarySerializer(handler),
logHandler: handler,
closed: false,
}
return gremlinProtocol, nil
}

// loads results into the response set from the response
func (protocol *httpProtocol) responseHandler(resultSets *synchronizedMap, response response) error {
fmt.Println("Handling response")

Expand Down Expand Up @@ -130,6 +130,7 @@ func (protocol *httpProtocol) responseHandler(resultSets *synchronizedMap, respo
return nil
}

// serializes and sends the request
func (protocol *httpProtocol) write(request *request) error {
protocol.request = request
// TODO interceptors
Expand Down
2 changes: 1 addition & 1 deletion gremlin-go/driver/httpTransporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (transporter *httpTransporter) Connect() (err error) {

func (transporter *httpTransporter) Write(data []byte) error {
fmt.Println("Sending request message")
u, _ := url.Parse("http://localhost:8182/gremlin")
u, _ := url.Parse(transporter.url)
body := io.NopCloser(bytes.NewReader(data))

// TODO apply connection settings
Expand Down

0 comments on commit 74b7f93

Please sign in to comment.