--HG--
branch : adc
This commit is contained in:
mappu 2017-11-22 20:07:29 +13:00
parent 2fa40642a9
commit 0e8d76ef2f
1 changed files with 4 additions and 1 deletions

View File

@ -89,7 +89,7 @@ func (this *HubConnection) userJoined_Full(uinf *UserInfo) {
}
// SayRaw sends raw bytes over the TCP socket. Callers should add the protocol
// terminating character `|` themselves.
// terminating character themselves (e.g. `|` for NMDC).
// Note that protocol messages are transmitted on the caller thread, not from
// any internal libnmdc thread.
func (this *HubConnection) SayRaw(protocolCommand string) error {
@ -185,9 +185,12 @@ func (this *HubConnection) worker() {
// Attempt to parse a message block
for len(fullBuffer) > 0 {
// FIXME nmdc
for len(fullBuffer) > 0 && fullBuffer[0] == '|' {
fullBuffer = fullBuffer[1:]
}
protocolMessage := rxProtocolMessage.FindString(fullBuffer)
if len(protocolMessage) > 0 {
this.proto.ProcessCommand(protocolMessage[:len(protocolMessage)-1])