Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Vanadium
Jan 8, 2005

Do you really care about the newlines or can you just put the body into a json.Decoder directly and keep asking it to decode until .More() or w/e is false?

Adbot
ADBOT LOVES YOU

Vanadium
Jan 8, 2005

Hey, does anyone know if it's safe to try to close the same socket multiple times and/or from multiple goroutines, without risk to close an unrelated socket that reused the first socket's file descriptor after the first close?

I'm trying to untangle some messy websocket setup with separate reader/writer goroutines that currently leaks sockets unless we do the graceful websocket shutdown, and I'm trying to figure out if I can just try to close in some codepath that always gets taken or if I need to track across goroutines whether the graceful shutdown has taken place.

Vanadium
Jan 8, 2005

Thanks! I'd followed a websocket Close call with delve until I got to increfAndClose, where I figured it looks spooky enough that I wouldn't be confident in my own understand of the synchronization there either way. :shobon:

Vanadium
Jan 8, 2005

Does the ALB not reuse connections? Maybe I'm naive here but I'd have expected that session spinup gets amortized away immediately.

Vanadium
Jan 8, 2005

Yeah, if you use interface{} you have to cast to some other type (probably a nested map[string]interface{}) all the time. Writing down struct definitions is annoying if you have many/complicated json responses and we also mostly deal with that by having both service and caller share autogenerated protobuf structs. But I'd definitely prefer writing a struct definition over a bunch of casting, particularly because it also documents the overall shape of the expected response locally.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply