--HG--
branch : adc
This commit is contained in:
mappu 2017-11-22 20:07:29 +13:00
parent 2fa40642a9
commit 0e8d76ef2f

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 // 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 // Note that protocol messages are transmitted on the caller thread, not from
// any internal libnmdc thread. // any internal libnmdc thread.
func (this *HubConnection) SayRaw(protocolCommand string) error { func (this *HubConnection) SayRaw(protocolCommand string) error {
@ -185,9 +185,12 @@ func (this *HubConnection) worker() {
// Attempt to parse a message block // Attempt to parse a message block
for len(fullBuffer) > 0 { for len(fullBuffer) > 0 {
// FIXME nmdc
for len(fullBuffer) > 0 && fullBuffer[0] == '|' { for len(fullBuffer) > 0 && fullBuffer[0] == '|' {
fullBuffer = fullBuffer[1:] fullBuffer = fullBuffer[1:]
} }
protocolMessage := rxProtocolMessage.FindString(fullBuffer) protocolMessage := rxProtocolMessage.FindString(fullBuffer)
if len(protocolMessage) > 0 { if len(protocolMessage) > 0 {
this.proto.ProcessCommand(protocolMessage[:len(protocolMessage)-1]) this.proto.ProcessCommand(protocolMessage[:len(protocolMessage)-1])