"fmt"
"github.com/jhalter/mobius/concat"
"math/rand"
- "net"
)
const (
tranGetFileInfo = 206
tranSetFileInfo = 207
tranMoveFile = 208
- tranMakeFileAlias = 209 // TODO: implement file alias command
+ tranMakeFileAlias = 209
tranDownloadFldr = 210
// tranDownloadInfo = 211 TODO: implement file transfer queue
// tranDownloadBanner = 212 TODO: figure out what this is used for
}, tranLen, nil
}
-func readN(conn net.Conn, n int) ([]Transaction, error) {
- buf := make([]byte, 1400)
- i := 0
- for {
- readLen, err := conn.Read(buf)
- if err != nil {
- return nil, err
- }
-
- transactions, _, err := readTransactions(buf[:readLen])
- // spew.Fdump(os.Stderr, transactions)
- if err != nil {
- return nil, err
- }
-
- i += len(transactions)
-
- if n == i {
- return transactions, nil
- }
- }
-}
-
func readTransactions(buf []byte) ([]Transaction, int, error) {
var transactions []Transaction