mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-01-20 15:40:40 +01:00
Use previous SIDs if we get an unexpected serial/audio req. success
This commit is contained in:
parent
0c6812396c
commit
7327ff3215
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -212,28 +213,23 @@ func (s *controlStream) handleRead(r []byte) error {
|
|||
// 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa8, 0x03, 0x03,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
s.secondAuthTimer.Stop()
|
||||
s.requestSerialAndAudioTimeout.Stop()
|
||||
|
||||
devName := s.parseNullTerminatedString(r[64:])
|
||||
log.Print("got serial and audio request success, device name: ", devName)
|
||||
|
||||
if !s.serialAndAudioStreamOpenRequested {
|
||||
return errors.New("not requested serial and audio streams yet")
|
||||
}
|
||||
|
||||
// The auth ID can change in the meantime because of a previous login...
|
||||
// Stuff can change in the meantime because of a previous login...
|
||||
s.common.remoteSID = binary.BigEndian.Uint32(r[8:12])
|
||||
s.common.localSID = binary.BigEndian.Uint32(r[12:16])
|
||||
copy(s.authID[:], r[26:32])
|
||||
s.secondAuthTimer.Stop()
|
||||
|
||||
if s.requestSerialAndAudioTimeout != nil {
|
||||
s.requestSerialAndAudioTimeout.Stop()
|
||||
s.requestSerialAndAudioTimeout = nil
|
||||
}
|
||||
|
||||
if err := s.serial.start(devName); err != nil {
|
||||
return err
|
||||
return errors.New("serial/" + err.Error())
|
||||
}
|
||||
|
||||
if err := s.audio.start(devName); err != nil {
|
||||
return err
|
||||
return errors.New("audio/" + err.Error())
|
||||
}
|
||||
|
||||
s.serialAndAudioStreamOpened = true
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -41,7 +41,7 @@ func runControlStream(osSignal chan os.Signal) (shouldExit bool, exitCode int) {
|
|||
c.deinit()
|
||||
|
||||
// Need to wait before reinit because the IC-705 will disconnect our audio stream eventually if we relogin
|
||||
// in a too short interval...
|
||||
// in a too short interval without a deauth...
|
||||
t := time.NewTicker(time.Second)
|
||||
for sec := 65; sec > 0; sec-- {
|
||||
log.Print("waiting ", sec, " seconds...")
|
||||
|
|
|
|||
Loading…
Reference in a new issue