Skip to content

Commit

Permalink
Fix panic that can occur in timeout if Prev Path Segment is not prope…
Browse files Browse the repository at this point in the history
…rly present. (networkservicemesh#600)

Signed-off-by: Ed Warnicke <hagbard@gmail.com>
Signed-off-by: Sergey Ershov <sergey.ershov@xored.com>
  • Loading branch information
edwarnicke authored and Sergey Ershov committed Dec 20, 2020
1 parent 29133d1 commit 28e4b42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/networkservice/common/timeout/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ func (t *timeoutServer) request(ctx context.Context, request *networkservice.Net
func (t *timeoutServer) createTimer(ctx context.Context, conn *networkservice.Connection, executor *serialize.Executor) (*time.Timer, error) {
logEntry := log.Entry(ctx).WithField("timeoutServer", "createTimer")

expireTime, err := ptypes.Timestamp(conn.GetPath().GetPathSegments()[conn.GetPath().GetIndex()-1].GetExpires())
if conn.GetPrevPathSegment().GetExpires() == nil {
return nil, errors.Errorf("expiration for prev path segment cannot be nil. conn: %+v", conn)
}
expireTime, err := ptypes.Timestamp(conn.GetPrevPathSegment().GetExpires())
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 28e4b42

Please sign in to comment.