@@ -177,15 +177,15 @@ func (s *Server) messageHandler(msg protocol.Message) error {
177177}
178178
179179func (s * Server ) handleRequestNext () error {
180- // TODO: figure out why this one log message causes a panic (and only this one)
181- // during tests (#857)
182- // s.Protocol.Logger().
183- // Debug("request next ",
184- // "component ", "network" ,
185- // "protocol ", ProtocolName ,
186- // "role ", "server" ,
187- // "connection_id", s.callbackContext.ConnectionId.String(),
188- // )
180+ if s . Protocol != nil {
181+ s . Protocol . Logger ().
182+ Debug ( "request next" ,
183+ "component" , "network " ,
184+ "protocol " , ProtocolName ,
185+ "role " , "server" ,
186+ "connection_id " , s . callbackContext . ConnectionId . String () ,
187+ )
188+ }
189189 if s .config == nil || s .config .RequestNextFunc == nil {
190190 return errors .New (
191191 "received chain-sync RequestNext message but no callback function is defined" ,
@@ -195,13 +195,15 @@ func (s *Server) handleRequestNext() error {
195195}
196196
197197func (s * Server ) handleFindIntersect (msg protocol.Message ) error {
198- s .Protocol .Logger ().
199- Debug ("find intersect" ,
200- "component" , "network" ,
201- "protocol" , ProtocolName ,
202- "role" , "server" ,
203- "connection_id" , s .callbackContext .ConnectionId .String (),
204- )
198+ if s .Protocol != nil {
199+ s .Protocol .Logger ().
200+ Debug ("find intersect" ,
201+ "component" , "network" ,
202+ "protocol" , ProtocolName ,
203+ "role" , "server" ,
204+ "connection_id" , s .callbackContext .ConnectionId .String (),
205+ )
206+ }
205207 if s .config == nil || s .config .FindIntersectFunc == nil {
206208 return errors .New (
207209 "received chain-sync FindIntersect message but no callback function is defined" ,
@@ -230,13 +232,15 @@ func (s *Server) handleFindIntersect(msg protocol.Message) error {
230232}
231233
232234func (s * Server ) handleDone () error {
233- s .Protocol .Logger ().
234- Debug ("done" ,
235- "component" , "network" ,
236- "protocol" , ProtocolName ,
237- "role" , "server" ,
238- "connection_id" , s .callbackContext .ConnectionId .String (),
239- )
235+ if s .Protocol != nil {
236+ s .Protocol .Logger ().
237+ Debug ("done" ,
238+ "component" , "network" ,
239+ "protocol" , ProtocolName ,
240+ "role" , "server" ,
241+ "connection_id" , s .callbackContext .ConnectionId .String (),
242+ )
243+ }
240244 // Restart protocol
241245 s .Stop ()
242246 s .initProtocol ()
0 commit comments