Closed chicknsoup closed 4 years ago
Cannot build. You accidentally put an extra opening brace in the if block.
Also, how about using strings.HasPrefix
instead of doing a substring match
with strings.Contains
? Can you update your changes this way?
if !strings.HasPrefix(lname, sockPrefix) {
continue
}
Sure, i'll update it.
In some cases, where server is running with thousands of connections, looping through all the file descriptors takes times. I have tested on a server with 20k connections and it took around 1m30s to get all socket information. After adding !strings.Contains(lname, "socket") to the loop the cost reduced significantly to around 25 seconds.