This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch reduce-handle-connect-time
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git


The following commit(s) were added to refs/heads/reduce-handle-connect-time by 
this push:
     new d990165  update conntrack
d990165 is described below

commit d990165206538d5bb9ece30a2d9c40e6c28b1fe9
Author: mrproliu <[email protected]>
AuthorDate: Sat Dec 28 12:35:29 2024 +0800

    update conntrack
---
 pkg/tools/ip/conntrack.go | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/pkg/tools/ip/conntrack.go b/pkg/tools/ip/conntrack.go
index e3306a6..4fbfff3 100644
--- a/pkg/tools/ip/conntrack.go
+++ b/pkg/tools/ip/conntrack.go
@@ -41,7 +41,7 @@ func NewConnTrack() (*ConnTrack, error) {
        }
 
        go func() {
-               evCh := make(chan conntrack.Event, 1024)
+               evCh := make(chan conntrack.Event, 2048)
 
                // Listen for all Conntrack and Conntrack-Expect events with 4 
decoder goroutines.
                // All errors caught in the decoders are passed on channel 
errCh.
@@ -59,12 +59,19 @@ func NewConnTrack() (*ConnTrack, error) {
                // Start a goroutine to print all incoming messages on the 
event channel.
                go func() {
                        for {
-                               log.Infof("conntrack: %+v", <-evCh)
+                               e := <-evCh
+                               log.Infof("conntrack: type: %s, origin: 
%s:%d->%s:%d, reply: %s:%d->%s:%d", e.Type,
+                                       e.Flow.TupleOrig.IP.SourceAddress, 
e.Flow.TupleOrig.Proto.SourcePort,
+                                       e.Flow.TupleOrig.IP.DestinationAddress, 
e.Flow.TupleOrig.Proto.DestinationPort,
+                                       e.Flow.TupleReply.IP.SourceAddress, 
e.Flow.TupleReply.Proto.SourcePort,
+                                       
e.Flow.TupleReply.IP.DestinationAddress, 
e.Flow.TupleReply.Proto.DestinationPort)
                        }
                }()
 
                // Stop the program as soon as an error is caught in a decoder 
goroutine.
-               log.Print(<-errCh)
+               if err := <-errCh; err != nil {
+                       log.Errorf("conntrack error: %v", err)
+               }
        }()
 
        query, err := conntrack.Dial(nil)

Reply via email to