217 sub read_expect { 218 my $class = shift; 219 my($ssh, $type) = @_; 220 my $pack = $class->read($ssh); 221 if ($pack->type != $type) { 222 $ssh->fatal_disconnect(sprintf 223 "Protocol error: expected packet type %d, got %d", 224 $type, $pack->type); 225 } 226 $pack; 227 }