7 Commits

Author SHA1 Message Date
9b32682c8a libnmdc: support hub-redirects 2016-04-04 19:01:55 +12:00
c9e95df0df libnmdc: fix for previous 2016-04-04 19:01:47 +12:00
a2b94e8724 libnmdc: send protocol-level keepalives 2016-04-04 18:57:50 +12:00
3dfef302ee Added tag nmdc-log-service-1.0.2 for changeset da9f123633f9 2016-04-03 19:24:12 +12:00
611a934a4e nmdc-log-service: readme 2016-04-03 19:24:03 +12:00
1a3617b960 libnmdc: readme 2016-04-03 19:23:14 +12:00
a37b1773d0 Added tag libnmdc-r4 for changeset 050b424a7c5d 2016-04-03 19:22:02 +12:00
4 changed files with 28 additions and 9 deletions

View File

@@ -3,3 +3,5 @@
137c1b65039e03c80379826a6efdfd808f6fbc8f libnmdc-r2
d8b64d5527c2a5e4d76872e5bc3d69f7646135c6 libnmdc-r3
fca41372e400853775b02e951f9db91d87f41adb nmdc-log-service-1.0.1
050b424a7c5d5a27c9323c8810f3afbead1f5b96 libnmdc-r4
da9f123633f9c28be6435ed7898139665d4c39d9 nmdc-log-service-1.0.2

View File

@@ -1,7 +1,7 @@
An NMDC client protocol library for Golang.
- Channel-based API.
- Includes a sample logging client.
- Offers both channel-based and synchronous APIs.
- Includes a sample logging client using the channel-based API.
- This code hosting site isn't (yet) compatible with `go get`.
Written in golang
@@ -9,6 +9,11 @@ Tags: nmdc
=CHANGELOG=
2016-04-03 r4
- Feature: Add synchronous API
- Fix an issue with reading HubConnection's state parameter
- Fix an issue with buffered protocol commands
2016-04-03 r3
- Feature: Add `SkipVerifyTLS` option
- Fix an issue with calling `panic()` if connection failed

View File

@@ -15,6 +15,7 @@ import (
const (
DEFAULT_CLIENT_TAG string = "libnmdc.go"
DEFAULT_HUB_NAME string = "(unknown)"
SEND_KEEPALIVE_EVERY time.Duration = 29 * time.Second
)
type ConnectionState int
@@ -314,15 +315,13 @@ func (this *HubConnection) processProtocolMessage(message string) {
this.State = CONNECTIONSTATE_CONNECTED
}
case "$UserCommand":
// $UserCommand 1 1 Group chat\New group chat$<%[mynick]> !groupchat_new&#124;|
// TODO
case "$ForceMove":
// TODO
this.Hco.Address = HubAddress(commandParts[1])
this.conn.Close() // we'll reconnect onto the new address
// IGNORABLE COMMANDS
case "$Supports":
case "$UserCommand": // TODO $UserCommand 1 1 Group chat\New group chat$<%[mynick]> !groupchat_new&#124;|
case "$UserList":
case "$OpList":
case "$HubTopic":
@@ -370,7 +369,17 @@ func (this *HubConnection) worker() {
// Read from socket into our local buffer (blocking)
if this.connValid {
readBuff := make([]byte, 1024)
this.conn.SetReadDeadline(time.Now().Add(SEND_KEEPALIVE_EVERY))
nbytes, err = this.conn.Read(readBuff)
if err != nil && err.(net.Error).Timeout() {
// No data before read deadline
err = nil
// Send KA packet
_, err = this.conn.Write([]byte("|"))
}
if nbytes > 0 {
fullBuffer += string(readBuff[0:nbytes])
}

View File

@@ -30,6 +30,9 @@ Usage of nmdc-log-service:
=CHANGELOG=
2016-04-03 1.0.2
- Enhancement: Upgrade `libnmdc` from `r3` to `r4`
2016-04-03 1.0.1
- Enhancement: Add `-VerifyTLS` option
- Enhancement: Upgrade `libnmdc` from `r2` to `r3`