Skip to content

Commit

Permalink
halah
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikidepia committed Feb 1, 2025
1 parent 56c0189 commit 48185bf
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions handlers/scraper/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func handleConnection(conn net.Conn) {
conn.Close()
}()
sessCount.Add(1)
tmp := make([]byte, 1024*128)

for {
select {
Expand Down Expand Up @@ -84,19 +85,16 @@ func handleConnection(conn net.Conn) {
var fromRemote bytes.Buffer
dec := gob.NewDecoder(&fromRemote)

tmp := make([]byte, 256)
for {
n, err := conn.Read(tmp)
if err != nil {
if err != io.EOF {
slog.Error("failed to read data", "err", err)
rm.outChan <- err
return
}
break
n, err := conn.Read(tmp)
if err != nil {
if err != io.EOF {
slog.Error("failed to read data", "err", err)
rm.outChan <- err
return
}
fromRemote.Write(tmp[:n])
break
}
fromRemote.Write(tmp[:n])

if err := dec.Decode(rm.instaData); err != nil {
fmt.Println(fromRemote.Bytes())
Expand Down

0 comments on commit 48185bf

Please sign in to comment.