File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -167,19 +167,24 @@ func (s *RegistryServer) onConn(conn net.Conn) {
167167 }()
168168
169169 // reply to edge
170+ conn .SetWriteDeadline (time .Now ().Add (time .Second * 10 ))
170171 err = codec .WriteJSON (conn , codec .CmdRegister , & codec.RegisterReply {
171172 EdgeList : otherEdges ,
172173 Routes : otherRoutes ,
173174 })
175+ conn .SetWriteDeadline (time.Time {})
174176 if err != nil {
175177 log .Error ("write json fail: %v" , err )
176178 return
177179 }
180+
178181 // keepalived
179182 fail := 0
180183 hb := codec.Heartbeat {}
181184 for {
185+ conn .SetReadDeadline (time .Now ().Add (time .Second * 30 ))
182186 header , body , err := codec .Read (conn )
187+ conn .SetReadDeadline (time.Time {})
183188 if err != nil {
184189 log .Error ("read fail: %v" , err )
185190 fail += 1
You can’t perform that action at this time.
0 commit comments