-
Notifications
You must be signed in to change notification settings - Fork 398
Using TCP connection and simple JSON protocol instead of HTML #42
Conversation
world/Plugins/Docker/docker.lua
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dtFall constant should be available globally, you should use the constant rather than a magic number, because the constant's integral value may change in a future version of the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This was from a commit by @dave-tucker, I don't know what happened with my merge... But I can fix it.
I'm currently working on this. I tested it, and the answer is no, stats monitoring go routines never end... I'm fixing it. |
This one should be fixed now! :) |
|
I'll try to merge that PR finally next week, I would like to work on funnier stuff! :) |
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@docker.com>
Signed-off-by: Adrien Duermael <adrien@duermael.com>
Signed-off-by: Adrien Duermael <adrien@duermael.com>
Signed-off-by: Adrien Duermael <adrien@duermael.com>
Signed-off-by: Adrien Duermael <adrien@duermael.com>
Signed-off-by: Adrien Duermael <adrien@duermael.com>
Signed-off-by: Adrien Duermael <adrien@duermael.com>
|
@dave-tucker @gdevillele ok, that was a hell of a merge... |
|
HOLY REBASE BATMAN! 😲
|
|
@dave-tucker I can totally do that! Thought would really like to understand why it's necessary, as Dockercraft can't be used as a package for another Go application. I'm preparing a commit with to move the files! |
|
@aduermael I guess it's not entirely necessary but we did it in #59 so it seems silly to revert it again. It's probably me being an idealist as I would consider it a "best practice" 😉 |
Signed-off-by: Adrien Duermael <adrien@duermael.com>
|
@dave-tucker ok! I understand, thanks! |
This PR addresses #12.
Lua plugin had to execute goproxy with arguments, and they were transmitted to the goproxy daemon over http. The goproxy daemon could send information to the Lua plugin using http requests as well.
This PR replaces all this with a single TCP connection and a simple JSON protocol. Lua plugin and goproxy daemon can use this to exchange JSON messages.
JSON strings can be sent in both directions, each sequence should end with
'\n'.It means JSON data has to be condensed, it can't contain
'\n' characters (outside of string values). This protocol can be improved later, but it works so far.Tagged as WIP because it has to be heavily tested.
Also, I listed these necessary fixes:
Reading from cNetwork TCP client is non-blocking. I guess this should be fixed in Cuberite. I'll take a look at it myself: http://apidocs.cuberite.org/cNetwork.html (blocking at this level doesn't mean it will be blocked at the Lua level). This is why I added a delay inIt's not necessary to have this in order to merge the PR. The delay in go code will be sufficient for now.goproxy/main.go, inhandleConnfunction, a few lines afterconn.Read(buf[cursor:]).