http - What is the proper way to detect a dropped connection in Go? -


i working go http server implementation reads upload mobile client. however, i'm experiencing problems because of long keep-alive, server hang reading request buffer quite long time if mobile client goes offline (as happens).

what proper way detect dropped connection , close input buffer?

set reasonable timeout on server, example:

srv := &http.server{     addr: ":443",     readtimeout: time.minute * 2,     writetimeout: time.minute * 2, } log.fatal(srv.listenandservetls(certfile, keyfile)) 

Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -